VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Load bitmaps straight into memory

IRBMe  (22 Submissions)   Games   Visual Basic 3.0   Intermediate   Wed 3rd February 2021

Do you have a game with too many pictureboxes for your graphics. Want to make your game really proffessional by loading them straight into RAM. Even returns all the properties of your bitmap. Can be used with 3 liones of code. This is to be used with bitblt. Not compatible with Windows NT due to the loadfromfile constant being restricted or something.

Inputs
Use it like this: Private sub sub Form_Load() Me.show Dim lngDC as long Dim bmpProperties as BITMAP lngDC = GenerateDC(C:\Bitmap.Bmp,bmpProperties) Msgbox BmpProperties.bmwidth me.scalemode = vbpixels Bitblt me.hdc,0,0,me.scalewidth,me.scaleheight,lngDC,0,0,vbsrccopy deletegenerateddc lngdc end sub

Assumes
You place the code in a module.

Returns
Puts a bitmap in memory and returns its properties and a DC to it. Then when you are finished just delete the dc using the provided sub.

Side Effects
Remember to delete the DC or you might start losing some resources. Dont attempt to use on Windows NT.

API Declarations
Various. See code

Rate Load bitmaps straight into memory (4(4 Vote))
Load bitmaps straight into memory.bas

Load bitmaps straight into memory Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters