Tired of loading icons or bitmaps or creating many images withthe several styles of pictures in form modules that blow up yourapplication and slow it down in VB3?
If so, you can create several icons or bitmaps of similar style.Then create a pure text (ASCII) file like printer.txt or printer.rcthis way:
NameID_keyword_[load-option]_ [mem-option]_filename
First, define each of the terms in this code. Where nameID equalsInteger or name, the ID has to be unique for every category specifiedby the keyword:
keyword = ICON,BITMAP
If the code “[load-option]” is equal to PRELOAD, thenthe resource loads immediately. If it is equal to LOADONCALL,the (Default) resource loads when called.
If the code “[mem-option]” is equal to FIXED, the resourceremains at a fixed memory location. If it is equal to MOVABLE,then the (Default) Resource can be moved if necessary in orderto compact memory. If it is equal to DISCARDABLE, then the resourcecan be discarded if no longer needed.
And “filename” specifies the name of the file that containsthe resource. The name must be a valid MS-DOS file name, and itmust be a full path if the file is not in the current workingdirectory. The path can be either quoted or nonquoted string.The text file looks like this:
1 ICON LOADONCALL DISCARDABLE _ C:ICONS...PRNTMAN0.ICO9 ICON LOADONCALL DISCARDABLE _ C:ICONS...PRNTMAN8.ICO
Open the DOS-WINDOW in Win 3.1 or return to DOS and run the rc.exethat shipped with the German version of VB4 Pro (also on the American/Englishversion CD-ROM).
It may look like this:
C:VBRESOURCERC16
c -r printer.rc
or for the 32-bit RES file:
C:VBRESOURCERC32
c -r printer.rc
Next, push enter and the resource file will soon be generated.Search for the file named “printer.res” or the nameyou have chosen.
Create a new project. Add a picture box and a timer to your form.Then add the RES file to your project.
The timer-event looks like this:
Private Sub Timer1_Timer()Static ID ID = ID+1 IF ID = 10 Then ID = 1 End IF Picture.Picture = _ LoadResPicture(ID,1)End Sub
Don’t forget to set the timer interval.