ShutdownPlugin not called when I X the console? (just curious)

May 20, 2008
12,331
134
Syracuse, NY, USA
The short question is "Is that WAD?".

Here's why I ask. I'm reworking an old plugin (4AUTOTRAY). In the new version, the tray icon is always present and the left-click behavior and right-click menu change depending on whether TCC is minimized or restored. So I want to get rid of the tray icon when TCC exits. Doing that in ShutdownPlugin doesn't work (neither does a simple Beep) and the tray icon hangs around until I swipe it.

It's no problem because it works if I do it in DllMain when dwReason == DLL_PROCESS_DETACH. I was just curious.
 
ShutdownPlugin will always be called when you exit TCC, in any fashion.

With the proviso that Windows will kill the process after three or four seconds when you X it, and if you have a TCEXIT or slow ShutdownPlugin's, then it may not get a chance to run.
 
Hmmm! Here's ShutdownPlugin.

Code:
BOOL WINAPI ShutdownPlugin( BOOL b4ntExit )
{
    Beep(440,100);
    return 0;
}

If I issue EXIT I hear the beep. If I X the console I don't. Either way there are no delays.
 
So, after putting Beep(440,100); in ShutdownPlugin, I built the example from the most recent SDK. Same story ... I hear the beep if I EXIT, I don't hear the beep if I X the console.
 
OK, I know what's going on. I'm embarrassed to say exactly what but it deals with some experimental stuff in another plugin that monkeys with the TCC.EXE class window.

And, FWIW, the SDK sample (2019 version) built OK with no changes but to avoid "Procedure not found - InitializePlugin" I had to add the .DEF file to Properties\Linker\Input because, without it, the names were exported decorated. I've run into that often. Isn't there another way to export undecorated names?
 

Similar threads