Windows Vista

Post Reply
User avatar
clemerson
Posts: 58
Joined: Fri Mar 10, 2006 8:13 pm
Location: Brazil
Contact:

Windows Vista

Post by clemerson »

Hi,

I access my system and to leave it, enter again and I say that this open granddaughter function... I give a time and I obtain to enter again, happens to each 10 attempts a time.

oWnd:=FindWindow( 0, "Sistema - SysFar" )
If oWnd!=0
MsgAlert("O Programa SysFar já se encontra aberto ...","Informação !!!")
BringWindowToTop( oWnd )
Return(.f.)
Endif

I use fwh 7.01

Clemerson
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Clemerson,

You could use an else just to check if the code fails sometimes:

Code: Select all

hWnd:=FindWindow( 0, "Sistema - SysFar" ) 
If hWnd!=0 
   MsgAlert("O Programa SysFar já se encontra aberto ...","Informação !!!") 
   BringWindowToTop( hWnd ) 
   Return(.f.) 
else
   MsgAlert( "can't find the main window" )
Endif 
regards, saludos

Antonio Linares
www.fivetechsoft.com
derpipu
Posts: 93
Joined: Tue Mar 28, 2006 4:09 pm
Location: Tequila, Jalisco Mexico
Contact:

check it

Post by derpipu »

IF findWindow( 0,oApp:cEmpresa + oApp:cSistema) > 0
MsgWait( "Atención, el Programa ya está abierto...", oApp:cEmpresa + oApp:cSistema ); QUIT
ENDIF


Regards

Luis Fernando Rubio Rubio
Tequila, Jalisco, Mexico.
Luis Fernando Rubio Rubio
User avatar
clemerson
Posts: 58
Joined: Fri Mar 10, 2006 8:13 pm
Location: Brazil
Contact:

Post by clemerson »

ok, I go to make plus these tests...

Clemerson
Rossine
Posts: 343
Joined: Tue Oct 11, 2005 11:33 am

Post by Rossine »

Olá Clemerson,

Veja se é isto que você precisa:

Code: Select all


#include "FiveWin.ch"

function Main

   local oWnd

   if IsExeRunning( cFileName( HB_ARGV( 0 ) ) )
      msgstop( "Este programa ja esta sendo executado !!!" )
      ShowApplication()
   else
      DEFINE WINDOW oWnd TITLE "Teste"

      ACTIVATE WINDOW oWnd
   endif
   
return nil

function ShowApplication

   local hWnd := FindWindow( 0, "Teste" )

   if hWnd != nil
      showwindow( hWnd, 0 )
      showwindow( hWnd, 6 )
      showwindow( hWnd, 9 )
   endif

return nil
Abraços,

Rossine.
Post Reply