In Icz's Tutorials, there is a program to show a bmp file. How can i accomplish this without using the resource file. By that i mean, how can i tell the program to show a bmp in a certian directory? I am trying to keep the size of the program to a minimum. If the bmp file isn't defined, then it can only grow in size right? So instead of having a 50+kb program to show Bugs Bunny & Tweety. I can have a 5kb program that just needs to be told where to locate the file to show...right? Does that make any sense? How can this be done? Thanks, Nokturnal
Posted on 2001-02-20 13:22:00 by Nokturnal
What follows is some code similar to what you're doing, except it uses that dang resource file. However, it opens the bitmap as binary data (IE, not thru LoadBitmap); essentially it duplicates the LoadBitmap function in asm code. Just change the pointer to say a mem mapped bitmap file and this should work the same.

    invoke FindResource,hInstance, IDM_BITMAP_, RT_RCDATA
    invoke LoadResource, hInstance, eax      ; get handle to resource
    invoke LockResource, eax
    mov pSource, eax    ; change THIS to point to your mem mapped file
; get the bitmap to memory
    mov eax, pSource            ; use pDest with decompression
    mov pBitmapFileHeader, eax
    xor edx, edx
    mov dx,    
    cmp dx, 4D42H   ; 'BM' in hex
    jne BadFile
    mov edx, pBitmapFileHeader
    add eax, (BITMAPFILEHEADER PTR ).bfOffBits
    mov pBitmapData, eax
    mov eax, pBitmapFileHeader
    mov pBitmapInfoHeader, eax
    mov edx, pBitmapInfoHeader
    mov eax, (BITMAPINFOHEADER PTR ).biWidth
    mov nWidth, eax
    mov eax, (BITMAPINFOHEADER PTR ).biHeight
    mov nHeight, eax

    invoke GetDC, hIDM_picture
    mov hDCtemp, eax
    invoke CreateCompatibleDC, hDCtemp
    mov hDC, eax    
    invoke CreateDIBitmap, hDCtemp, pBitmapInfoHeader, CBM_INIT, pBitmapData, 
                              pBitmapInfoHeader, DIB_RGB_COLORS
    mov hBitmap, eax
    invoke SendMessage, hIDM_picture,STM_SETIMAGE,IMAGE_BITMAP, hBitmap
Posted on 2001-02-20 13:32:00 by Ernie
Thanks Ernie, you just answered my question which I rised a few weeks earlier. Thanks again. What Nokturnal is asking is probably to use LoadImage instead of using LoadBitmap. LoadBitmap loads from the resource. LoadImage loads from a bitmap.BMP file sitting in the directory. forge
Posted on 2001-02-20 22:46:00 by forge