Can anyone give me any directions on how to load a dll from a resource
dll, which will form part of an external dll using watcom 1.7a
regards
Adrian
compiler should be irrelevant. Suppose your resource dll (precisely: the DLL
your icon resource is bound to) is named RESOURCE.DLL and the icon has an id
of ICON_ID:
CHAR szError[CCHMAXPATH];
APIRET rc = NO_ERROR;
HMODULE hmod = NULLHANDLE;
HPOINTER hpointer = NULLHANDLE;
rc = DosLoadModule(szError,sizeof(szError),"RESOURCE",&hmod); // if resource
DLL is on LIBPATH, otherwise specify full path and filename with file
extension
if (rc == NO_ERROR)
{
hpointer = WinLoadPointer(HWND_DESKTOP,hmod,ICON_ID);
if (!hpointer)
{
// use WinGetLastError to get the exact error condition
goto exit;
}
// use the pointer
WinDestroyPointer(hpointer);
}
else
{
// szError will give you additional info where the loading failure
originates from
}
exit:
if (hmod)
{
rc = DosFreeModule(hmod);
}
One thing that always confused me about OS/2 is if there is a difference
between a POINTER and an ICON. As far as I understand, there is none. So, if
you need a HICON instead of a HPOINTER you can safely cast HPOINTER to
HICON.
P.S: If you can be sure that the resource DLL is already loaded you can use
DosQueryModuleHandle instead of DosLoadModule.
P.P.S: I am not 100 % sure if the resource DLL has to be loaded for the time
you are making use of the icon. The code above assumes so.
"Adrian Suri" <adrian.su...@irusdev.co.uk> schrieb im Newsbeitrag
news:nOFPj.46657$_h7....@newsfe05.ams2...
Thanks for that finally got it working.....
Adrian