FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Bring another APP to top
Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Bring another APP to top
Posted: Mon Mar 14, 2011 02:19 PM
Hi, how can I bring another APP to top?

I developed an app to kill the task of my main project before start the compilation process, but the focus of the APP don't back for the compilation.

PS.: I Don't have the WindowText of this other APP so I can't use this code bellow

Code (fw): Select all Collapse
   CFILENAME := "test.exe"

   IF ISEXERUNNING( CFILENAME( HB_ARGV( 0 ) ) )
      msginfo("Test is running","Attenzione")
      SHOWWINDOW( FINDWINDOW( 0, "TEST" ), 9 )
      SETFOREGROUNDWINDOW( FINDWINDOW( 0, "TEST" ) )
      RETURN NIL
   ENDIF

  DEFINE WINDOW m->oWnd TITLE "TEST"
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Re: Bring another APP to top
Posted: Thu Mar 17, 2011 11:29 AM

Nobody?

Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Bring another APP to top
Posted: Thu Mar 17, 2011 12:48 PM

I am not sure I understand what you are trying to do, but maybe this is what you need. Save the foreground window then later set it to the foregroundWindow again using setForegroundWindow().

LOCAL hWnd := GETFOREGROUNDWINDOW()

DLL32 FUNCTION GETFOREGROUNDWINDOW() AS LONG;
PASCAL FROM "GetForegroundWindow" LIB "user32.dll"

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion