Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Aug 8, 1997



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Speed Your Animations and Save Memory

Tired of loading icons or bitmaps or creating many images with the several styles of pictures in form modules that blow up your application 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.rc this way:


First, define each of the terms in this code. Where nameID equals Integer or name, the ID has to be unique for every category specified by the keyword:

keyword = ICON,BITMAP

If the code "[load-option]" is equal to PRELOAD, then the 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 resource remains at a fixed memory location. If it is equal to MOVABLE, then the (Default) Resource can be moved if necessary in order to compact memory. If it is equal to DISCARDABLE, then the resource can be discarded if no longer needed.

And "filename" specifies the name of the file that contains the resource. The name must be a valid MS-DOS file name, and it must be a full path if the file is not in the current working directory. The path can be either quoted or nonquoted string. The text file looks like this:


Open the DOS-WINDOW in Win 3.1 or return to DOS and run the rc.exe that shipped with the German version of VB4 Pro (also on the American/English version CD-ROM).

It may look like this:

C:\VB\RESOURCE\RC16\rc -r printer.rc

or for the 32-bit RES file:

C:\VB\RESOURCE\RC32\rc -r printer.rc

Next, push enter and the resource file will soon be generated. Search for the file named "printer.res" or the name you 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 = _
End Sub

Don't forget to set the timer interval.

Uwe Pryka
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date