GetExitCodeProcess und Excel
13.04.2009 20:45:54
Norman
ich google mich blöde und finde keine Antwort....
Ich habe das HWND von Excel über Application.Hwnd geholt. Dann übergebe ich das HWND (per registry) an eine andere Excel-Instanz und prüfe dort mit anhängender Funktion, ob die 1. Excel-Instanz noch läuft. Leider schlägt GetExitCodeProcess für das HWND immer mit einem LastDllError = 6 fehl.
Habt ihr eine Idee, was ich falsch mache?
Viele Grüße
Norman
Private Declare Function GetExitCodeProcess Lib _
"Kernel32" (ByVal hProcess As Long, _
lpExitCode As Long) As Long
Private Const STILL_ACTIVE = &H103
Public Function ProgStillActive(ByVal hwndProzess As Long) As Boolean
Dim lngLäuft As Long
ProgStillActive = False
If GetExitCodeProcess(hwndProzess, lngLäuft) > 0 Then
If lngLäuft = STILL_ACTIVE Then
ProgStillActive = True
Else
ProgStillActive = False
End If
Else
Debug.Print Err.LastDllError
End If
End Function