Several ways to get a DC handle under Windows

Source: Internet
Author: User
The 1.sdkwin32 API function obtains the DC handle in the view class hdc HDCHDC=::GETDC (M_hwnd);:: ReleaseDC (M_HWND,HDC)//must release handle 2. Using MFC to get the DC handle CDC *pdc= GetDC (); ReleaseDC (PDC)//must release handle 3. Use CCLIENTDC to obtain a DC handle (no call to release function, destructor automatically called) CClientDC DC (this)//scope within the view window CCLIENTDC DC ( GetParent ())//scope within the Fraim framework CCLIENTDC does not need to call the release function, the parse function automatically calls 4. Use CWINDOWDC to get a DC handle (no call to release function, destructor automatically called) CWINDOWDC DC (this) Scope within the view window CWINDOWDC DC (GetParent ())//scope within Fraim frame CWINDOWDC DC (GetDesktopWindow ())//scope of action across the desktop


Several ways to get a DC handle under Windows

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.