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.
  • 相关阅读:
    洛谷P1656 炸铁路 题解 并查集
    洛谷P1455 搭配购买 题解 并查集+01背包
    欧拉计划第16题题解
    欧拉计划第15题题解
    欧拉计划第14题题解
    scrapy 爬虫保存数据
    FileNotFoundError: File b'score.xlsx' does not exist
    图片截取
    图像过滤器
    如何查看字符编码?
  • 原文地址:https://www.cnblogs.com/mars9/p/2328033.html
Copyright © 2011-2022 走看看