已知某个窗体的HDC,如何求得此窗体的句柄(300分)

  • 主题发起人 主题发起人 Hexi
  • 开始时间 开始时间
找到了,用WindowFromDC 函数
 
恭喜,混分。
 
你查的蛮快的啊 ~
------------------------------------------------------
WindowFromDC
The WindowFromDC function returns a handle to the window associated with the specified display device context (DC). Output functions that use the specified device context draw into this window.

HWND WindowFromDC(
HDC hDC // handle to window
);
Parameters
hDC
[in] Handle to the device context from which a handle for the associated window is to be retrieved.
Return Values
The return value is a handle to the window associated with the specified DC. If no window is associated with the specified DC, the return value is NULL.

Requirements
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Winuser.h; include Windows.h.
Library: Use User32.lib.

See Also
Painting and Drawing Overview, Painting and Drawing Functions, GetDC, GetDCEx, GetWindowDC
 
给分阿。
 
多人接受答案了。
 
后退
顶部