Window class release problem

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.