Hierarchy of windows

Hierarchy of windows

Postby Natter » Tue Aug 09, 2022 7:58 pm

Hi,

My application window is in the foreground. How can I get a window handle located under my window ?
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Re: Hierarchy of windows

Postby nageswaragunupudi » Wed Aug 10, 2022 12:31 am

Code: Select all  Expand view
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
User avatar
nageswaragunupudi
 
Posts: 10626
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Hierarchy of windows

Postby nageswaragunupudi » Wed Aug 10, 2022 12:32 am

Also you can use the function
Code: Select all  Expand view
BringWindowToTop( hWnd )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10626
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Hierarchy of windows

Postby Natter » Wed Aug 10, 2022 6: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
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Re: Hierarchy of windows

Postby Jimmy » Wed Aug 10, 2022 8: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: Select all  Expand view
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
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Hierarchy of windows

Postby Natter » Wed Aug 10, 2022 11:09 am

Yes, I understand. Rao, Jimmy thank you !
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Re: Hierarchy of windows

Postby nageswaragunupudi » Wed Aug 10, 2022 6: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: Select all  Expand view

GetWindow( hWnd, 2 or 3 )
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10626
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 79 guests