cs_JMO
Messages postés1854Date d'inscriptionjeudi 23 mai 2002StatutMembreDernière intervention24 juin 2018
-
24 nov. 2005 à 20:57
cs_JMO
Messages postés1854Date d'inscriptionjeudi 23 mai 2002StatutMembreDernière intervention24 juin 2018
-
25 nov. 2005 à 07:06
Bonsoir à tous....
Comment, en VBS, énumérer les fenêtres actives ???
Dans la doc Script56, GetWindow n'existe pas.
Et sur le forum, je n'ai trouvé que des exemples en VB.
cs_JMO
Messages postés1854Date d'inscriptionjeudi 23 mai 2002StatutMembreDernière intervention24 juin 201827 25 nov. 2005 à 07:06
Bonjour à tous....
J'ai récupéré le code indiqué.
Question:
Comment l'adapter:
Je ne veux pas de InputBox, je souhaite simplement qu'avec
un raccourci bureau (ex: Mes documents)
Si on double/click sur ce raccourci:
- test pour savoir s'il y a une fenetre s'appelant Mes Documents
est active, si oui, la mettre au 1er plan;
si non active, l'ouvrir via WshShell.Run "C:\WINDOWS\EXPLORER.EXE /n,/e," & wSrce
Eventuellement, faire un msgbox ou popup contenant le nom
des fenetres actives
Function IsProcessRunning( strServer, strProcess )
Dim Process, strObject
IsProcessRunning = False
strObject = "winmgmts://" & strServer
For Each Process in GetObject( strObject ).InstancesOf( "win32_process" )
If UCase( Process.name ) = UCase( strProcess ) Then
IsProcessRunning = True
Exit Function
End If
Next
End Function
' ****************************************************************************
' Main
' ****************************************************************************
Dim strComputer, strProcess
Do
strProcess = inputbox( "Please enter the name of the process (for instance: explorer.exe)", "Input" )
Loop until strProcess <> ""
Do
strComputer = inputbox( "Please enter the computer name", "Input" )
Loop until strComputer <> ""
If( IsProcessRunning( strComputer, strProcess ) = True ) Then
WScript.Echo "Process " & strProcess & " is running on computer " & strComputer
Else
WScript.Echo "Process " & strProcess & " is NOT running on computer " & strComputer
End If