Page 1 of 1
Hierarchy of windows
Posted: Tue Aug 09, 2022 7:58 pm
by Natter
Hi,
My application window is in the foreground. How can I get a window handle located under my window ?
Re: Hierarchy of windows
Posted: Wed Aug 10, 2022 12:31 am
by nageswaragunupudi
Code: Select all | Expand
function Main()
local oWnd
DEFINE WINDOW oWnd FROM 100,100 TO 400,400 PIXEL TITLE "First Window"
@ 20,20 BUTTON "New Window" SIZE 200,50 PIXEL OF oWnd ;
ACTION ( CreateNextWindow( oWnd ), oWnd:GoTop() )
ACTIVATE WINDOW oWnd
return nil
function CreateNextWindow( oMain )
local oWnd
DEFINE WINDOW oWnd FROM 200,200 TO 500,500 PIXEL OF oMain
ACTIVATE WINDOW oWnd
return nil
Re: Hierarchy of windows
Posted: Wed Aug 10, 2022 12:32 am
by nageswaragunupudi
Also you can use the function
Re: Hierarchy of windows
Posted: Wed Aug 10, 2022 6:35 am
by Natter
Rao, thank you for your reply. But I didn 't understand how it would help me ? There is a window of someone else's application under my window and I need to get a window handle of this someone else's application. In this case, using the FindWindow() function is not possible
Re: Hierarchy of windows
Posted: Wed Aug 10, 2022 8:30 am
by Jimmy
hi,
under HMG we have this Function
https://docs.microsoft.com/de-de/windows/win32/api/winuser/nf-winuser-getnextwindow?redirectedfrom=MSDNCode: Select all | Expand
HB_FUNC (GETNEXTWINDOW)
{
HWND hWnd = (HWND) HMG_parnl (1);
HWND hWndNext = GetWindow (hWnd, GW_HWNDNEXT);
HMG_retnl ((LONG_PTR) hWndNext );
}
GW_HWNDNEXT 2 Returns a handle to the window below the given window.
GW_HWNDPREV 3 Returns a handle to the window above the given window.
Re: Hierarchy of windows
Posted: Wed Aug 10, 2022 11:09 am
by Natter
Yes, I understand. Rao, Jimmy thank you !
Re: Hierarchy of windows
Posted: Wed Aug 10, 2022 6:55 pm
by nageswaragunupudi
But I didn 't understand how it would help me ?
Sorry. Your question was different and my answer was different.
While adopting Mr. Jimmy's advice, you need not write all the 'C' code.
You can use the FWH function GetWindow() directly in your program with the same syntax.