ecmsoft Posted June 12, 2013 Report Share Posted June 12, 2013 Preciso saber, via sistema, se um serviço está instalado no Windows. Tem alguma função que faça isso ? Quote Link to comment Share on other sites More sharing options...
SAOliveira Posted June 12, 2013 Report Share Posted June 12, 2013 Veja se Ajuda. IF(!PCS_StatusExe("QualPrograma")) **------------------------------------------------------------------------------**** 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.NextRETURN(Wexecutando) **----------------------------------------------------------** STATIC FUNCTION Service_WMI()**----------------------------------------------------------** STATIC oWmiService LOCAL oScriptObj IF(oWmiService==NIL) oScriptObj=CREATEOBJECT("wbemScripting.SwbemLocator") oWmiService=oScriptObj:ConnectServer() ENDIF RETURN(oWmiService) Quote Link to comment Share on other sites More sharing options...
ecmsoft Posted June 12, 2013 Author Report Share Posted June 12, 2013 Valeu, Sergio. Funcionou !! 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.