Unload v1.0a Copyright © 1991, by Mike Sax Compuserve: 75470,1403 Tel: +3237663264 Fax: +3237781405 Contents -------- - About Unload - When you might need Unload - The "PLEASE INSERT THE DISK WITH TOOLHELP.DLL INTO DRIVE A:" message - The list of libraries and tasks - Methods to unload - Obtaining source code About Unload ------------ Unload is a small programmer's utility that lets you remove any Windows program or dynamic link library from memory. It can be useful when you are developing a Windows program or DLL that has a problem with getting unloaded. Instead of having to exit Windows to remove the module from memory, you can just use unload and recompile. When you might need Unload -------------------------- Basically, Unload is only useful when you have a library or program that you can't remove with the "standard" user's methodes, like selecting "End Task" option in the task list, or closing the app's Window. This could occur if a library's usage count is higher than zero, but the app that is using it was terminated, or you have an Application that doesn't have any visible Windows. The "PLEASE INSERT THE DISK WITH TOOLHELP.DLL INTO DRIVE A:" message -------------------------------------------------------------------- To get a list of all libraries and modules, Unload uses the Microsoft ToolHelp DLL, which is also distributed in the Dr. Watson diagnostics program. If you don't have toohelp.dll on your system, you can obtain Dr. Watson from Microsoft, or download it from Compuserve and most other bulletin board systems. The ToolHelp.Dll file should be either in the same directory as unload.exe, or it should be in a directory that is in your current path. If it isn't, you'll get the error message described above. The list of libraries and tasks ------------------------------- Unload displays a list of all libraries and tasks that are loaded or running on your system. Since fonts and drivers are also DLL's they're also in the list. If you have several instances of a module running, Unload will display the module once for every task, so you can unload them individually. Tasks are displayed in uppercase, DLL's are in lowercase. When you select a library or task, Unload will display a little information about it, like the usage count, wether it's a library or a task, the program's filename and the module handle. Methods to unload ----------------- There's only one method to unload a DLL: decrease the module's usage count. If you want to unload a task, you can use any of three methods. You can: 1) Post a WM_QUIT message to the application, which is like calling the PostQuitMessage function inside the applicaton ; 2) Post a WM_CLOSE message to all the applications's main windows, even if they are invisible ; or 3) Terminate the application. Terminating the application is the most drastic and is as if an unrecoverable application error would occur. Posting WM_CLOSE is the "softest" method to unload an application, and it's also used by the task manager (although the task manager won't find any invisible windows). Posting WM_QUIT is also quite "soft", because it gives the application the oppertunity to do any clean up after its main message loop. Terminating the application is the most drastic measure and it will immediately terminate the application. You should only use this when absolutely necessary. Obtaining Source Code --------------------- Because as of this writing Microsoft has not published any documentation about the ToolHelp API, Unload's source code cannot be included. If you'd like to have it, send me a message on Compuserve (75470,1403) and I'll send it to you as sooon as the ToolHelp API is made public.