IPBX_Marshaler interface:
GetModuleHandle method
Description
Returns the handle of the PBX that contains the native class. This method is required to allow the PowerBuilder VM to determine which PBXs can be unloaded.
Syntax
GetModuleHandle( )
Return Values
pbulong
Examples
This code in the implementation of a marshaler class returns the handle of the PBX:
extern pbulong thisModuleHandle;
pbulong SampleMarshaler::GetModuleHandle()
{
return thisModuleHandle;
}
The handle is set in the main module:
pbulong thisModuleHandle = 0;
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
thisModuleHandle = (pbulong)hModule;
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
Usage
You must implement this method in the marshaler native class.