通过调用GetDC(NULL)返回哪种类型的DC? [英] What type of DC is returned by calling GetDC(NULL)?

查看:58
本文介绍了通过调用GetDC(NULL)返回哪种类型的DC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows API函数 GetDC() 接受一个参数:

The Windows API function GetDC() accepts a single parameter:

hWnd

要获取其DC的窗口的句柄.如果该值为NULL,则GetDC将检索整个屏幕的DC.

A handle to the window whose DC is to be retrieved. If this value is NULL, GetDC retrieves the DC for the entire screen.

在页面的下方,注意以下内容:

Further down the page, the following is noted:

使用通用DC绘画后,必须调用 ReleaseDC 函数以释放DC.类别DC和私有DC不必释放. ReleaseDC 必须从与 GetDC 相同的线程中调用.DC的数量仅受可用内存的限制.

After painting with a common DC, the ReleaseDC function must be called to release the DC. Class and private DCs do not have to be released. ReleaseDC must be called from the same thread that called GetDC. The number of DCs is limited only by available memory.

不幸的是,目前尚不清楚屏幕DC是否需要调用 ReleaseDC(),因为在任何地方都未提及其类型.实际上,此页面描述了五种类型的DCs;但他们都没有提到屏幕".

Unfortunately, it is unclear whether calling ReleaseDC() is necessary for a screen DC since its type is not mentioned anywhere. In fact, this page describes five types of DCs; but none of them mention "screen".

我是否需要在屏幕DC上调用 ReleaseDC()?

Do I need to call ReleaseDC() on a screen DC?

推荐答案

屏幕DC不是类DC,也不是私有DC,所以是的-它需要释放.

A screen DC is not a class DC, and it's not a private DC, so yes - it needs to be released.

这篇关于通过调用GetDC(NULL)返回哪种类型的DC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆