A DLL with a form is written, called when the DLL is initialized: if ((one = FindWindow (Sipselect_clsname, NULL)) = null) { SetForegroundWindow (one); Retailmsg (1, (TEXT ("Lib-init Open 1/r/n")); return;} But the second time the DLL is loaded fails, of course it will fail later. The design found that if ((one = FindWindow (Sipselect_clsname, null)) = NULL) failed, causing the DLL to continue executing the load. However, if you do not increase this judgment, several times after the DLL is loaded, the definition of multiple DLL form classes will be generated in memory, resulting in a memory leak. Analysis: (1) the RegisterClass () Form class was not disposed, resulting in the above error. Check MSDN, there is a corresponding function unregisterclass () to complete the form class release. (2) After calling this function, the beginning does not achieve the desired effect. Debugging found that this function call failed further through GetLastError () to get the error code is: 1412-the category still has an open window (3) After knowing the reason, in the DLL application's wm_destory response, call Destorywindow () to destroy the window, Unregisterclass () call succeeded. DLL required to implement the implementation of the function!
Window class release problem