Re: RemoveWindowSubclass in DllMain (DETACH)
This note is related to a case when the process is shutting down as a result
of ExitProcess call. In that case, you should simply return from your
DllMain.
"Vincent Fatica" <vince@blackholespam.net> wrote in message
news:4a2c8196$1@news.vefatica.net...
My plugin DLL subclasses a window involved in hosting it (with
SetWindowSubclass
(comctl32)). The only process termination notification I get is via
DLL_THREAD_DETACH and DLL_PROCESS_DETACH. I'm calling
RemoveWindowSubclass
(comctl32) in response to DLL_THREAD_DETACH and it's working (whereas
calling it
in response to DLL_PROCESS_DETACH or not calling it at all causes a
crash).
But the docs for DllMain warn (with reference to User, Shell, and COM
functions)
"calling functions such as these during termination can cause access
violation
errors because the corresponding component may already have been unloaded
or
uninitialized".
What am I to do?
One thought is to GetModuleHandle(L"COMCTL32", already loaded by host) and
dig
out the two needed functions rather than link my DLL with COMCTL32. Would
that
be any better. Is there anything easier?
Thanks.
--
- Vince