This is a discussion on loatbitmap fails in a dll - Programmer ; I have a DLL that has a bitmap resource (btw this is an old 16-bit program). hbmp = LoadBitmap(tophinst,MAKEINTRESOURCE(1)); Above code runs fine in a test program. When I include the same code in a dll LoadBitmap returns a null. ...
I have a DLL that has a bitmap resource (btw this is an old 16-bit program).
hbmp = LoadBitmap(tophinst,MAKEINTRESOURCE(1));
Above code runs fine in a test program. When I include the same code in a dll
LoadBitmap returns a null.
The resource file (RC's) are identical in the exe and the DLL so the problem is
not in MAKEINTRESOURCE(1)
Something must be wrong in the tophinst.
I tried (in the dll source):
tophinst=(HINSTANCE) GetWindowWord( dllwin, GWW_HINSTANCE );
and
tophinst=LoadLibrary ("mydll.dll");
and
int FAR PASCAL LibMain (HANDLE hInstance, WORD wDataSeg, WORD wHeapSize, LPSTR
lpszCmdLine)
{
tophinst=hInstance;
but none worked. Is there something special when a dll need to load a bitmap
resource in the dll and not from the main exe?