识别鼠标是放在文本文件上还是控件上.txt

来自「图像处理学习的一些心得」· 文本 代码 · 共 23 行

TXT
23
字号
用WindowFromPoint或ChildWindowFromPoint获得控件的句柄,然后用GetClassName判断窗口类,文本框是Edit,按钮是Button


The WindowFromPoint function retrieves a handle to the window that contains the specified point. 

HWND WindowFromPoint(
  POINT Point  // point
);


int GetClassName(
  HWND hWnd,           // handle to window
  LPTSTR lpClassName,  // class name
  int nMaxCount        // size of class name buffer
);
Parameters
hWnd 
[in] Handle to the window and, indirectly, the class to which the window belongs. 
lpClassName 
[out] Pointer to the buffer that is to receive the class name string. 
nMaxCount 
[in] Specifies the length, in TCHARs, of the buffer pointed to by the lpClassName parameter. The class name string is truncated if it is longer than the buffer. 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?