New functions

New functions

Postby Natter » Sun Nov 13, 2022 8: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 ? :(
Natter
 
Posts: 1224
Joined: Mon May 14, 2007 9:49 am

Re: New functions

Postby Jimmy » 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: Select all  Expand view  RUN
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: Select all  Expand view  RUN
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
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: New functions

Postby Natter » Sun Nov 13, 2022 11:30 am

Thank you, Jimmy, I understood !
Natter
 
Posts: 1224
Joined: Mon May 14, 2007 9:49 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 92 guests