GetDC怎么用???干什么的?

来源:百度知道 编辑:UC知道 时间:2024/06/06 05:22:59

获取设备指针

比如画图的时候用。

GetDC 函数状态: 正式函数 ,建设者:yello2000i ,最新更新时间: 2001-9-3 0:48:07 修改该函数

函数功能描述:该函数检索一指定窗口的客户区域或整个屏幕的显示设备上下文的句柄.以后可以在GDI函数中用该句柄绘图.

.函数原型:
HDC GetDC(HWND hWnd);

.参数:
hWnd:检索的窗口的句柄,若为NULL,GetDC则检索整个屏幕的设备上下文环境.
Windows 98,WindowsNT5.0或以后版本:如果hWnd=NULL,GetDC检索的首要是显示器的设备上下文环境,要得到其他的显示器的设备上下文环境,可用EnumDisplayMonitors和CreateDC函数.

.返回值:
如果成功,返回指定窗口客户区的设备上下文环境;如果失败,返回值为NULL.
Windows NT/ 2000 中可以通过调用GetLastError得到更多的错误信息。

CWnd::GetDC
CDC* GetDC( );

Return Value

Identifies the device context for the CWnd client area if successful; otherwise, the return value is NULL. The pointer may be temporary and should not be stored for later use.

Remarks

Retrieves a pointer to a common, class, or private device context for the client area depending on the class style specified for the CWnd. For common device contexts, GetDC assigns default at