My plugin needs to do some de-initialization on exit. This involves some network operations that can't be executed right away (it has to connect somewhere, and send some data).
My first question, how can I detect that N++ is exiting at all. I tried to listen to WM_CLOSE, but no luck. Best option for now was to hook into DLL DETACH procedures.
Second question, how would my plugin be able to delay the shutdown of N++? I'd like to display a dialog that says "Performing shutdown process" and wait until I get all the stuff out to the network...
The only other way I can think of is to resort to fully blocking socket operations. But that's just wrong....
Re
-Zobo
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
All the deallocations should be placed in the DllMain (or something equivalent in MFC) :
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD reasonForCall,
LPVOID lpReserved
)
{
switch (reasonForCall)
{
case DLL_PROCESS_ATTACH:
{
// YOUR INITIATION HERE
}
break;
case DLL_PROCESS_DETACH:
{
// YOUR DEALLOCATION HERE
}
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
return TRUE;
}
Don
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My plugin needs to do some de-initialization on exit. This involves some network operations that can't be executed right away (it has to connect somewhere, and send some data).
My first question, how can I detect that N++ is exiting at all. I tried to listen to WM_CLOSE, but no luck. Best option for now was to hook into DLL DETACH procedures.
Second question, how would my plugin be able to delay the shutdown of N++? I'd like to display a dialog that says "Performing shutdown process" and wait until I get all the stuff out to the network...
The only other way I can think of is to resort to fully blocking socket operations. But that's just wrong....
Re
-Zobo
All the deallocations should be placed in the DllMain (or something equivalent in MFC) :
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD reasonForCall,
LPVOID lpReserved
)
{
switch (reasonForCall)
{
case DLL_PROCESS_ATTACH:
{
// YOUR INITIATION HERE
}
break;
case DLL_PROCESS_DETACH:
{
// YOUR DEALLOCATION HERE
}
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
return TRUE;
}
Don
Thank Don. I'll try to work with that.
-Z