Thread: Loading bitmap in dll

  1. #1

    Loading bitmap in dll

    I'm trying to load a bitmap in my dll. I have the resource defined and I've got the bitmap included in my project.

    If I do this I can use LoadLibrary and access the bitmap using LoadBitmap from my executable however I'm trying to load the bitmap in my dll itself to use in my WM_PAINT functions but alas it doesn't load.

    Code:
    case WM_CREATE:
    {
      grid = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(ID_GRID));
    if(grid == NULL)
     MessageBox(hwnd,"Unable to load grid.bmp!!","Error",MB_OK);
    return 0;
    }
    I've defined the bitmap as:

    ID_GRID BITMAP "grid.bmp"

    ID_GRID is defined in the resource header as #define ID_GRID 5000
    Last edited by Mithoric; 12-22-2003 at 11:31 AM.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    MSDN on GetModuleHanlde()

    If the parameter is NULL, GetModuleHandle returns a handle to the file used to create the calling process.
    Might want to put the DLL's name in there.

    gg

  3. #3
    You champion!

    Thanks mate.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with Bitmap Display
    By The Brain in forum Windows Programming
    Replies: 7
    Last Post: 03-23-2009, 05:33 AM
  2. Loading a bitmap (Without using glaux)
    By Shamino in forum Game Programming
    Replies: 7
    Last Post: 03-16-2006, 09:43 AM
  3. OpenGL -- Bitmaps
    By HQSneaker in forum Game Programming
    Replies: 14
    Last Post: 09-06-2004, 04:04 PM
  4. Loading a Bitmap resource for OpenGL Texture[x]
    By the dead tree in forum Game Programming
    Replies: 4
    Last Post: 08-26-2004, 01:12 PM
  5. No one can seem to help me, loading bitmap
    By Shadow12345 in forum C++ Programming
    Replies: 7
    Last Post: 12-28-2002, 01:22 PM