My advice was always to use the excellent free tool "Windows API Viewer" that was hosted on Ron de Bruins web page, however, the link is currently pointing to a 404, don't know why. You can still find it using the way back machine. Note that there are some AV scanners that don't like the tool and mark it as potentially harmful, however from all I know this is a false alert - I have been using that tool for a long time and never had issues.
The output of that tool gave me the following declarations. Note that they are not tested (except for Sleep
)
#If VBA7 Then
Declare PtrSafe Function OpenProcess Lib "kernel32" Alias "OpenProcess" _
(ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As LongPtr
Declare PtrSafe Function GetExitCodeProcess Lib "kernel32" Alias "GetExitCodeProcess" _
(ByVal hProcess As LongPtr, _
lpExitCode As Long) As Long
Declare PtrSafe Sub Sleep Lib "kernel32" Alias "Sleep" _
(ByVal dwMilliseconds As Long)
#Else
' (This is your code)
Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long
Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal L_Prozess As Long, _
l_Ende As Long) As Long
Declare Sub Sleep Lib "Kernel32.dll" _
(ByVal SleepTime As Long)
#End If