Archived

This topic is now archived and is closed to further replies.

Zoot

Unload dll func?

Recommended Posts

Zoot    145
Hi, I when I unload my dll is there anyway so I can check from inside the dll if it is being unloaded? Like DllMain but I should be called when I unload it. - Zoot

Share this post


Link to post
Share on other sites
LessBread    1415
From the help entry for DllMain:

quote:

DLL_THREAD_DETACH Indicates that a thread is exiting cleanly. If the DLL has stored a pointer to allocated memory in a TLS slot, it uses this opportunity to free the memory. The system calls the entry-point function of all currently loaded DLLs with this value. The call is made in the context of the exiting thread.

DLL_PROCESS_DETACH Indicates that the DLL is being unloaded from the virtual address space of the calling process as a result of unsuccessfully loading the DLL, termination of the process, or a call to FreeLibrary. The DLL can use this opportunity to call the TlsFree function to free any TLS indices allocated by using TlsAlloc and to free any thread local data.



If your dll has access to the HWND for your program, you might try using PostMessage from one of these cases (PostMessage doesn''t block) - YMMV.

Share this post


Link to post
Share on other sites