Board index » cppbuilder » Resource Workshop Custom Control

Resource Workshop Custom Control


2004-03-03 11:56:45 PM
cppbuilder35
I have created a custom control to be used within Resource Workshop in
BC5.02. Everything works fine except a problem I get at design time.
I want to interpret the caption of the control as a resource ID and use this
to load a bitmap to display at design time. The problem comes when loading
the resource, as it is not found. I assume that the reason for this is that
the wrong module handle is being used , i take it the module handle I have
is the one to the custom control dll itself and therefore the resource I
wish to use is not in this module.
Does anyone know how to load a resource,from the currently loaded rc file in
resource workshop, in a custom control dll???
Any help would be greatly appreciated.
 
 

Re:Resource Workshop Custom Control

Hi Dominic:
This should work:
HINSTANCE globalHInstance=0; //global variable in your .DLL
HBITMAP hToolBit=0;
BOOL WINAPI DllEntryPoint( HINSTANCE hInst, DWORD fdwReason, LPVOID
/*lpvReserved*/ ) {
bool result = true;
switch( fdwReason ) {
case DLL_PROCESS_ATTACH:
globalHInstance = hInst;
result = InitWindowClasses( hInst );
hToolBit=LoadBitmap(globalHInstance,MAKEINTRESOURCE(IDB_SYSDATE1));
break;
case DLL_PROCESS_DETACH:
if (hToolBit)
DeleteObject(hToolBit);
break;
}
return result;
}
Saludos
Sebastian
"Dominic" < XXXX@XXXXX.COM >escribi?en el mensaje
Quote
I have created a custom control to be used within Resource Workshop in
BC5.02. Everything works fine except a problem I get at design time.

I want to interpret the caption of the control as a resource ID and use
this
to load a bitmap to display at design time. The problem comes when loading
the resource, as it is not found. I assume that the reason for this is
that
the wrong module handle is being used , i take it the module handle I have
is the one to the custom control dll itself and therefore the resource I
wish to use is not in this module.

Does anyone know how to load a resource,from the currently loaded rc file
in
resource workshop, in a custom control dll???

Any help would be greatly appreciated.