Just nu i M3-nätverket
Gå till innehåll

Shell


Calle11

Rekommendera Poster

Hej jag använder shell för att starta upp en applikation(barn). Medans barn applikationen exekverar färdigt vill jag att förälder applikationen skall vila för att sedan fortsätta att exekver när barn applikationen är klar. Typ:

 

.

.

.

task_id = shell(foralderapp.exe, 1)

while okand_funktion(task_id)

wait(1)

wend

.

.

.

 

Är det någon som vet om det finns någon funktion, okand_funktion, som kollar om en applikation är aktiv genom att kunna dess task id?

Länk till kommentar
Dela på andra webbplatser

Pontus Wång

Cut & Paste från VB-CodeLibrary som skulle besvara MÅNGA frågor i den här gruppen.

 

Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long

Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long

 

Public Const INFINITE = -1

 

Public Sub ShellWait(ByVal FileName As String, optional WindowStyle As Variant)

 

Dim idProc As Long

Dim hProc As Long

 

' start program and save PID

idProc = VBA.Shell(FileName, WindowStyle)

' get process handle

hProc = OpenProcess(PROCESS_ALL_ACCESS, False, idProc)

'wait till program has finished

If hProc <> hNull Then

Call WaitForSingleObject(hProc, INFINITE)

Call CloseHandle(hProc)

End If

 

End Sub

 

 

 

We sent a man to the moon with a computer that had the power of a C64 fifty years ago, today we are booting windows with computers that are a 1000 times faster! Are we making progress???

Länk till kommentar
Dela på andra webbplatser

Arkiverat

Det här ämnet är nu arkiverat och är stängt för ytterligare svar.

×
×
  • Skapa nytt...