FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour New functions
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
New functions
Posted: Sun Nov 13, 2022 08:51 AM
Hi,

2 new functions have been announced in FW2210 - GetTopWindow( [hWnd] ) and GetForegroundWindow(). What is the difference between them, isn't Top Window and Foreground Window the same thing ? :(
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: New functions
Posted: Sun Nov 13, 2022 11:23 AM
hi,
Natter wrote:2 new functions have been announced in FW2210 - GetTopWindow( [hWnd] ) and GetForegroundWindow().
What is the difference between them, isn't Top Window and Foreground Window the same thing ? :(
No

when have MsgInfo() it is "ON TOP" of all Windows even when switch to "other" App
Code (fw): Select all Collapse
ACTIVATE WINDOW oWnd ON INIT MakeTop( oWnd ) CENTER

PROCEDURE MakeTop( oObj )
   SetWindowPos( oObj:hWnd, HWND_TOPMOST, ;
                 oObj:nTop, oObj:nLeft, ;
                 oObj:nWidth, oObj:nHeight )
RETURN
this is when using Style HWND_TOPMOST

Foreground Windows is when App is running and you start e.g. a 2nd Instance which you not want
Code (fw): Select all Collapse
INIT PROCEDURE MainInit()
LOCAL cTitle  := "phpBB Forum Grabber " + cVersion
LOCAL hWndDlg := FindWindowEx(,,, cTitle )
   IF !( hWndDlg == 0 )
      MsgInfo( "phpBB Forum Grabber " + cVersion + " is running ..." )
      IF ISMINIMIZED( hWndDlg )
         RESTORE( hWndDlg )
      ENDIF
      SetForegroundWindow( hWndDlg )
      BringWindowToTop( hWndDlg )
      ShowWindow( hWndDlg, 1 )
      UpdateWindow( hWndDlg )
      QUIT                                  // It is a second instance. Bye Bye
   ENDIF
RETURN
this will bring running App into Foreground and set Focus on App
greeting,

Jimmy
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: New functions
Posted: Sun Nov 13, 2022 11:30 AM

Thank you, Jimmy, I understood !

Continue the discussion