SmallestWindowFromPoint 获得包含指定坐标的最小窗口的句柄
来源:互联网 发布:java开发相关书籍 编辑:程序博客网 时间:2024/04/30 09:44
//-----------------------------------------------
// SmallestWindowFromPoint
// Notice: from PasswordSpy by Brian Friesen
//
// Find the smallest window still containing the point
//
// WindowFromPoint returns the first window in the Z-order ->
// if the password control is sorounded by a Group Box or some other control,
// WindowFromPoint returns the handle to the sorounding control instead
// to the password control.
//
HWND SmallestWindowFromPoint( const POINT point )
{
RECT rect, rcTemp;
HWND hParent, hWnd, hTemp;
hWnd = ::WindowFromPoint( point );
if( hWnd != NULL )
{
::GetWindowRect( hWnd, &rect );
hParent = ::GetParent( hWnd );
// Has window a parent?
if( hParent != NULL )
{
// Search down the Z-Order
hTemp = hWnd;
do{
hTemp = ::GetWindow( hTemp, GW_HWNDNEXT );
// Search window contains the point, hase the same parent, and is visible?
::GetWindowRect( hTemp, &rcTemp );
if(::PtInRect(&rcTemp, point) && ::GetParent(hTemp) == hParent && ::IsWindowVisible(hTemp))
{
// Is it smaller?
if(((rcTemp.right - rcTemp.left) * (rcTemp.bottom - rcTemp.top)) < ((rect.right - rect.left) * (rect.bottom - rect.top)))
{
// Found new smaller window!
hWnd = hTemp;
::GetWindowRect(hWnd, &rect);
}
}
}while( hTemp != NULL );
}
}
return hWnd;
}
- SmallestWindowFromPoint 获得包含指定坐标的最小窗口的句柄
- WindowFromPoint -- 获得包含指定点的窗口的句柄
- 窗口句柄的获得
- 窗口句柄的获得
- 窗口句柄的获得
- 窗口句柄的获得
- 窗口句柄的获得
- 窗口句柄的获得
- 获得指定进程的句柄数
- 通过指定Shell Embedding/IEFrame类窗口的句柄获得浏览器(IE)对象
- MFC获得窗口句柄的方法
- MFC 怎样获得某个窗口的句柄?
- 【C++】获得窗口和控件的句柄
- MFC 怎样获得某个窗口的句柄?
- 进程句柄HANDLE获得进程主窗口的句柄HWND
- VC2008获取指定的窗口句柄
- GetParent获得的是父窗口的父窗口句柄
- 通过进程ID获得该进程主窗口的句柄或者获得特定窗口句柄
- first things first
- 删除eclipse3.4的configuration目录导致eclipse无法启动的解决办法
- GetParent Function
- Struts学习笔记之ActionForm
- java数字转汉字大写(全)
- SmallestWindowFromPoint 获得包含指定坐标的最小窗口的句柄
- vsftp配置大全---超完整版
- void HighlightWindow( HWND hwnd, BOOL fDraw ) 高亮指定窗口
- 支付宝通过招行网上银行付钱,最多每笔500块
- pku1062 昂贵的聘礼(Memory Limit Exceeded。。。。。。)
- 使用 HTML5 构建下一代的 Web Form
- oracle学习笔记2
- 书评:简洁代码──敏捷软件工艺指南
- dll中使用ado时遇见的问题