FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Hierarchy of windows
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Hierarchy of windows
Posted: Tue Aug 09, 2022 07:58 PM

Hi,

My application window is in the foreground. How can I get a window handle located under my window ?

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Hierarchy of windows
Posted: Wed Aug 10, 2022 12:31 AM
Code (fw): Select all Collapse
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
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Hierarchy of windows
Posted: Wed Aug 10, 2022 12:32 AM
Also you can use the function
Code (fw): Select all Collapse
BringWindowToTop( hWnd )
Regards



G. N. Rao.

Hyderabad, India
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Hierarchy of windows
Posted: Wed Aug 10, 2022 06:35 AM

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

Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Hierarchy of windows
Posted: Wed Aug 10, 2022 08:30 AM
hi,

under HMG we have this Function
https://docs.microsoft.com/de-de/windows/win32/api/winuser/nf-winuser-getnextwindow?redirectedfrom=MSDN

Code (fw): Select all Collapse
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.
greeting,

Jimmy
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Hierarchy of windows
Posted: Wed Aug 10, 2022 11:09 AM

Yes, I understand. Rao, Jimmy thank you !

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Hierarchy of windows
Posted: Wed Aug 10, 2022 06:55 PM

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.

Code (fw): Select all Collapse
GetWindow( hWnd, 2 or 3 )
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion