The difference between the WS_CHILD and WS_POPUP windows created by CWnd

Source: Internet
Author: User

The difference between the WS_CHILD and WS_POPUP windows created by CWnd

Recently, I was writing a self-painted window derived from CWnd. Previously, the Create FUNCTION FOR Packaging my own classes was written like this:

Bool CGG: Create (DWORD dwstyle, const rect & rect, cwnd * pparentwnd, uint NID, ccreatecontext * pcontext) <br/>{< br/> If (! Cwnd: Create (guoguotipsupwindow_classname, null, dwstyle, rect, pparentwnd, NID, pcontext) <br/> return false; </P> <p> return true; <br/>}< br/>

This is also the case. The WS_CHILD windows previously created are called as follows:

DWORD style = WS_CHILD | WS_OVERLAPPED;
M_tooltips.Create (style, CRect (0, 0, 300,300), NULLthis, NULL, NULL );

No problem.

This time we will create a WS_POPUP window, which will be called as follows:

DWORD style = WS_POPUP | WS_OVERLAPPED;
M_tooltips.Create (style, CRect (0, 0, 300,300), NULL );

However, the result is crash and depressing.

After checking for half a day, we found that the implementation of the Create FUNCTION had a problem.

The CWnd: Create Function can only Create window styles that are not WS_POPUP. To create a WS_POPUP window and an extended window, you must call CWnd: CreateEx.

MSDN description of Create:

Creates and initializes the child window associated withCwndObject.

 

 

Description of CreateEx on MSDN:

Creates a Windows overlapped, pop-up, or child window and attaches it toCwndObject.

Related Article

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.