Menu

Notepad++ exit

2007-08-04
2012-11-14
  • Damjan Cvetko

    Damjan Cvetko - 2007-08-04

    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

     
    • Don HO

      Don HO - 2007-08-04

      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

       
      • Damjan Cvetko

        Damjan Cvetko - 2007-08-05

        Thank Don.  I'll try to work with that.

        -Z