Luiz Fernando Posted July 10, 2019 Report Share Posted July 10, 2019 Colegas veja se alguém pode me ajudar. if IsExRunning("analise.exe") ? 'precisava chamar o sistema que já se encontra em aberto') else WinExex(cPath1+'fluxo\analise.exe') endif Obg Quote Link to comment Share on other sites More sharing options...
kapiaba Posted July 10, 2019 Report Share Posted July 10, 2019 Assim, impede que se abra no mesmo micro, se quer abrir, comente. IF ISEXERUNNING( CFILENAME( HB_ARGV( 0 ) ) ) MsgInfo( "Sistema.exe Já Está Rodando Nesta Máquina","Sistema.exe") SHOWWINDOW( FINDWINDOW( 0, "Sistema.exe" ), 9 ) SETFOREGROUNDWINDOW( FINDWINDOW( 0, "Sistema" ) ) FECHA_TUDO() RETURN NIL ENDIF Quote Link to comment Share on other sites More sharing options...
Luiz Fernando Posted July 10, 2019 Author Report Share Posted July 10, 2019 Ola Kapiaba, fiz igual seu exemplo, mais ele não chama o sistema function chamar_analise() if IsExeRunning("analise.exe") SHOWWINDOW( FINDWINDOW( 0, "analise.exe" ), 9 ) SETFOREGROUNDWINDOW( FINDWINDOW( 0, "analise" ) ) ? 'não acontece nada' else WinExec( cPath1+'fluxo\analise.exe' ) endIf return .t. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted July 11, 2019 Report Share Posted July 11, 2019 Você não entendeu. Isto, é para impedir de subir. Se quiser executar 2 ou mais vezes, retire isso e basta clickar 2 vezes no icone que o programa "sobe". Quote Link to comment Share on other sites More sharing options...
Marca Posted July 11, 2019 Report Share Posted July 11, 2019 O Kabra não lê mesmo ? 'precisava chamar o sistema que já se encontra em aberto') Ele quer abrir o .exe que já esta aberto. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted July 11, 2019 Report Share Posted July 11, 2019 Basta clickar no icone ou criar uma .BAT para chamar dentro do programa. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted July 11, 2019 Report Share Posted July 11, 2019 // \SAMPLES\TUTOR04.PRG MODIFICADO PARA CHAMAR UM .BAT. // We are going to build a PullDown menu and we are going to assign it // to our main Window // This example is the typical way of start building a FiveWin program #include "FiveWin.ch" static oWnd //----------------------------------------------------------------------------// function Main() local oIco, oBar, oBmp DEFINE ICON oIco FILE "..\icons\fax.ico" DEFINE WINDOW oWnd FROM 1, 1 TO 22, 75 ; TITLE "FiveWin sample" ; MENU BuildMenu() ; COLOR "B/W" ; ICON oIco DEFINE BUTTONBAR oBar _3D SIZE 26, 27 OF oWnd DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\new.bmp" FLAT ; ACTION ( CHAMA_TUTOR_VIA_BAT() ) /* ACTION MsgInfo( "New" ) ; TOOLTIP "Creates a new document" */ DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\open.bmp" FLAT ; ACTION MsgInfo( cGetFile( "*.*", "Select a document to open" ) ) ; TOOLTIP "Opens a document" WHEN .f. DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\floppy.bmp" FLAT ; ACTION MsgInfo( Time() ) TOOLTIP "Saves this document" DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\printer.bmp" FLAT ; ACTION MsgInfo( "Prints this document" ) TOOLTIP "Print this document" GROUP DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\prop.bmp" FLAT ; ACTION PrinterSetup() TOOLTIP "Setup the printer" DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\HelpInd.bmp" FLAT ; ACTION MsgInfo( Version() ) TOOLTIP "A multiple lines" + ; Chr( 13 ) + Chr( 10 ) + "tooltip!" GROUP DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\Help.bmp" FLAT ; ACTION MsgInfo( "fivewin power!" ) TOOLTIP "fivewin power!" DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\Exit.bmp" FLAT ; ACTION oWnd:End() TOOLTIP "Exit this app" GROUP DEFINE MESSAGE OF oWnd ; PROMPT FWVERSION + " " + FWCOPYRIGHT ; NOINSET CENTERED KEYBOARD DATE CLOCK DEFINE BITMAP oBmp FILENAME "..\bitmaps\fiveback.bmp" oWnd:bPainted = { | hDC | BmpTiled( hDC, oWnd, oBmp ) } ACTIVATE WINDOW oWnd ; VALID MsgYesNo( "Do you want to quit ?" ) return nil //----------------------------------------------------------------------------// function BuildMenu() local oMenu MENU oMenu MENUITEM "Information" MENU MENUITEM "&About..." ; ACTION MsgInfo( FWDESCRIPTION ) ; FILENAME "..\bitmaps\16x16\info.bmp" SEPARATOR MENUITEM "&End..." ; ACTION oWnd:End() FILENAME "..\bitmaps\16x16\exit.bmp" ENDMENU MENUITEM "&Clients" MENU MENUITEM "&New..." ; ACTION ( MsgStop( "New Clients" ),; oWnd:Say( 5, 5, "New Clients...", "GR+/G" ) ) ; FILENAME "..\bitmaps\16x16\faces.bmp" MENUITEM "&Modify..." ACTION MsgInfo( "Modif. Clients" ) ; FILENAME "..\bitmaps\edit.bmp" MENUITEM "&Delete..." ACTION MsgAlert( "Del Clients" ) ; FILENAME "..\bitmaps\16x16\delete.bmp" SEPARATOR MENUITEM "&Browse..." ACTION MsgInfo( "Browse Clients" ) ; FILENAME "..\bitmaps\16x16\browse.bmp" ENDMENU MENUITEM "&Utilities" MENU MENUITEM "&Calculator..." ACTION WinExec( "Calc" ) ; FILENAME "..\bitmaps\16x16\calc.bmp" MENUITEM "&Internet..." ; ACTION WinExec( "start iexplore www.fivetech.com", 0 ) ; FILENAME "..\bitmaps\16x16\explorer.bmp" ENDMENU ENDMENU return oMenu //----------------------------------------------------------------------------// STATIC FUNCTION BmpTiled( hDC, oWnd, oBmp ) local nWidth := oWnd:nWidth(), nHeight := oWnd:nHeight() local nRow := 0, nCol := 0, n local nBmpWidth := oBmp:nWidth(), nBmpHeight := oBmp:nHeight() if oBmp:hBitmap == 0 return nil endif while nRow < nHeight nCol = 0 while nCol < nWidth PalBmpDraw( hDC, nRow, nCol, oBmp:hBitmap ) nCol += nBmpWidth end nRow += nBmpHeight end return nil //----------------------------------------------------------------------------// FUNCTION CHAMA_TUTOR_VIA_BAT() // ASSIM MARCELO. LOCAL NOME_ARQ, NREGISTRO // AEVAL(DIRECTORY( "TUTOR04.BAT" ),{ |aFILE| FERASE(aFILE[F_NAME]) } ) IF .NOT. FILE( "TUTOR04.BAT" ) NOME_ARQ := FCREATE("TUTOR04.BAT") NREGISTRO := "@ECHO OFF" ; + CRLF + ; "CLS" + ; + CRLF + CRLF + ; ".\TUTOR04 > NUL" + ; + CRLF + CRLF + ; "CLS" + ; + CRLF + ; "EXIT" FWRITE( NOME_ARQ, NREGISTRO ) FCLOSE( NOME_ARQ ) ENDIF WinExec( "TUTOR04.BAT", 0 ) RETURN NIL Quote Link to comment Share on other sites More sharing options...
Marca Posted July 11, 2019 Report Share Posted July 11, 2019 hahahahaha ->>>>> FUNCTION CHAMA_TUTOR_VIA_BAT() // ASSIM MARCELO. Nosso amigo Luiz que tem que nos dizer agora se foi ou não kapiaba 1 Quote Link to comment Share on other sites More sharing options...
aferra Posted July 11, 2019 Report Share Posted July 11, 2019 Ele não lê. hahahahaah, essa faz tempo e já não utilizo, mas não deve ter tido mudanças. enfim. IF(!PCS_StatusExe("nome_do_exe.exe")) // faz o que quer ENDIF **------------------------------------------------------------------------------** ** Finalidade : Verificar se um Programa está em execução **------------------------------------------------------------------------------** FUNCTION PCS_StatusExe(cExecutavel) **------------------------------------------------------------------------------** LOCAL oWmiService,oListaProcess,oProcessos,Wexecutando:=.F. oWmiService=Service_WMI() oListaProcess:=oWmiService:ExecQuery("SELECT * FROM Win32_Process WHERE Name='"+cExecutavel+"'") FOR EACH oProcessos IN oListaProcess Wexecutando:=.t. Next RETURN(Wexecutando) **----------------------------------------------------------** STATIC FUNCTION Service_WMI() **----------------------------------------------------------** STATIC oWmiService LOCAL oScriptObj IF(oWmiService==NIL) oScriptObj=CREATEOBJECT("wbemScripting.SwbemLocator") oWmiService=oScriptObj:ConnectServer() ENDIF RETURN(oWmiService) kapiaba 1 Quote Link to comment Share on other sites More sharing options...
Luiz Fernando Posted July 13, 2019 Author Report Share Posted July 13, 2019 Obigado Kapiaba e Aferra, mais nenhuma das duas solução deu certo, outro detalhe que ocorre aqui que se eu chamar o sistema uma vez com o comando WinExec( cPath1+'fluxo\analise.EXE' ) e depois fechar ele, não consigo mais abrir o mesmo, preciso finalizar meu sistema principal. if IsExeRunning("analise.EXE") ? 'entra aqui como se o programa tivesse aberto, alem de estar fechado no rodape, verifiquei no processo do windows e tb não esta la' else WinExec( cPath1+'fluxo\analise.EXE' ) endif Quote Link to comment Share on other sites More sharing options...
Luiz Fernando Posted July 13, 2019 Author Report Share Posted July 13, 2019 RESOLVIDO, consegui resolver o problema, este outro EXE é feito em windev, e ao gerar o EXE tem uma opção que não deixa o sistema ser executado duas vezes, ao tentar ele abre o que já se encontra em aberto. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.