zoukankan      html  css  js  c++  java
  • 实例1.3:获得指定点的窗口

    获得指定点的窗口使用WindowFromPoint函数  

    函数功能:该函数获得包含指定点的窗口的句柄。   

    函数原型:HWND WindowFromPoint(POINT Point);   

    参数:   Point:指定一个被检测的点的POINT结构。   

    返回值S:返回值为包含该点的窗口的句柄。如果包含指定点的窗口不存在,返回值为NULL。如果该点在静态文本控件之上,返回值是在该静态文本控件的下面的窗口的句柄。   

    备注:WindowFromPoint函数不获取隐藏或禁止的窗口句柄,即使点在该窗口内。应用程序应该使用ChildWindowFromPoint函数进行无限制查询,这样就可以获得静态文本控件的句柄。

    	//获得指定点的窗口
    	CWnd* pWnd = WindowFromPoint(point);
    	if (pWnd != NULL)
    	{
    		if (IsChild(pWnd))
    		{
    			CString strText = _T("");
    			pWnd->GetWindowText(strText);
    			SetWindowText(strText);
    		}
    	}
    	CDialog::OnMouseMove(nFlags, point);
    

     另一个函数,IsChild,判断当前窗口是pWnd的子窗口或是CWnd的派生窗口。

    Life is like a box of chocolate, you never know what you are going to get.
  • 相关阅读:
    inline-block 文字与图片不对齐
    js去除数组重复项
    react2
    kfaka windows安装
    sigar 监控服务器硬件信息
    Disruptor
    Servlet 3特性:异步Servlet
    jvmtop 监控
    eclipse如何debug调试jdk源码
    一致性hash算法
  • 原文地址:https://www.cnblogs.com/mars9/p/2328033.html
Copyright © 2011-2022 走看看