WWW.ИСХОДНИКИ.РУ cpp.sources.ru
java.sources.ru web.sources.ru soft.sources.ru
jdbc.sources.ru asp.sources.ru api.sources.ru

  Форум на исходниках
  C / C++ / Visual C++
  окна на десктопе

СПРОСИТЬ  ОТВЕТИТЬ
профайл | регистрация | faq

Автор Тема:   окна на десктопе
gecky опубликован 23-11-2001 17:30 MSK   Click Here to See the Profile for gecky   Click Here to Email gecky  
как в spy++, находится окошко над которым в данный момент находится указатель. Чё-то порылся в msdn, подходящих функций не нашёл.
HELP!
al опубликован 23-11-2001 18:36 MSK     Click Here to See the Profile for al  Click Here to Email al     
В нормальном MSDN есть исходники SPY
gecky опубликован 23-11-2001 19:33 MSK     Click Here to See the Profile for gecky  Click Here to Email gecky     
но эта возможность появилась в spy++
gecky опубликован 23-11-2001 19:39 MSK     Click Here to See the Profile for gecky  Click Here to Email gecky     
или spy++ находит все окна, затем смотрит их местоположение, перекрытия, находит верхнее... Как то сложно получается
DmitryRyvkin опубликован 24-11-2001 01:41 MSK     Click Here to See the Profile for DmitryRyvkin  Click Here to Email DmitryRyvkin     
HWND WindowFromPoint(
POINT Point // structure with point
);
Только дл видных, для невидных другие
SUnteXx опубликован 24-11-2001 11:41 MSK     Click Here to See the Profile for SUnteXx  Click Here to Email SUnteXx     
WindowFromPoint
The WindowFromPoint function retrieves a handle to the window that contains the specified point.

HWND WindowFromPoint(
POINT Point // point
);
Parameters
Point
[in] Specifies a POINT structure that defines the point to be checked.
Return Values
The return value is a handle to the window that contains the point. If no window exists at the given point, the return value is NULL. If the point is over a static text control, the return value is a handle to the window under the static text control.

Remarks
The WindowFromPoint function does not retrieve a handle to a hidden or disabled window, even if the point is within the window. An application should use the ChildWindowFromPoint function for a nonrestrictive search.

Requirements
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Winuser.h; include Windows.h.
Library: Use User32.lib.

или


HWND ChildWindowFromPoint(
HWND hWndParent, // handle to parent window
POINT Point // structure with point coordinates
);


или


HWND RealChildWindowFromPoint(
HWND hwndParent, // handle to window
POINT ptParentClientCoords // client coordinates
);

.
.
.


а лучше


HWND SmallestWindowFromPoint(const POINT point)
{
RECT rect, rectSearch;
HWND pWnd, hWnd, hSearchWnd;

hWnd = WindowFromPoint(point);
if(hWnd != NULL)
{
GetWindowRect(hWnd, &rect);
pWnd = GetParent(hWnd);

if(pWnd != NULL)
{
hSearchWnd = hWnd;
do
{
hSearchWnd = GetWindow(hSearchWnd, GW_HWNDNEXT);

GetWindowRect(hSearchWnd, &rectSearch);
if(PtInRect(&rectSearch, point) && ::GetParent(hSearchWnd) == pWnd && ::IsWindowVisible(hSearchWnd))
{
if(((rectSearch.right - rectSearch.left) * (rectSearch.bottom - rectSearch.top)) < ((rect.right - rect.left) * (rect.bottom - rect.top)))
{
hWnd = hSearchWnd;
GetWindowRect(hWnd, &rect);
}
}
}
while(hSearchWnd != NULL);
}
}

return hWnd;
}

gecky опубликован 24-11-2001 12:05 MSK     Click Here to See the Profile for gecky  Click Here to Email gecky     
Огромное спасибо!

СПРОСИТЬ  ОТВЕТИТЬ
Перейти:


E-mail | WWW.ИСХОДНИКИ.RU

Powered by: Ultimate Bulletin Board, Freeware Version 5.10a
Purchase our Licensed Version- which adds many more features!
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 2000.