The best way to do this is to add a dll init term function to your DLL and store your
module handle in a global.

Here is the code:

HMODULE hmod;

unsigned long _System _DLL_InitTerm(unsigned long handle, unsigned long flag)
{
    /* init (/
    if (!flag)
    {
     hmod  = (HMODULE)handle;
    }
}



Serge Sterck wrote:

> I'm currently busy to write a unzip plugin for NS 4.61 and Mozilla
> But i have a problem when i want to load a dlgbox i'm obliged to
> load my plugin with DosLoadModule and pass to
> WinDlgBox the module handle as you see in the sample serge.txt
> i must hard coded the path where my plugin is
> is there a method to known from where the plugin is loaded ?
> or do you have a better code
>
>                                         many thanks
>
>   ------------------------------------------------------------------------
> void _Optlink Launch_NPLOAD(PVOID param)
> {
>     APIRET         rc;
>     HMODULE        hModule;
>     HAB            hab;
>     PluginInstance *This;
>
>     This = (PluginInstance *)param;
>     hab = WinInitialize(0);
>     This->hmq = WinCreateMsgQueue(hab,0);
>     rc   = DosLoadModule (NULL, 0, "f:\\mozilla\\bin\\plugins\\npunzip.dll", 
>&hModule);
>
>     WinDlgBox  (HWND_DESKTOP,
>                 HWND_DESKTOP,
>                 (PFNWP)NPLoadProc,
>                 (HMODULE)hModule,
>                 ID_NPLOAD,
>                 NULL);
>     rc = DosFreeModule( hModule );
>     WinDestroyMsgQueue(This->hmq);
>     WinTerminate(hab);
>     _endthread();
> }


Reply via email to