When using 64bit Windows, I have had to do the following
Code:Private Declare Function IsWow64Process Lib "kernel32.dll" (ByVal hProcess As Long, ByRef Wow64Process As Long) As Long Private Declare Function Wow64EnableWow64FsRedirection Lib "kernel32.dll" (ByVal Wow64FsEnableRedirection As Byte) As Byte Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long Private Function Is64bit() As Boolean Dim Ret As Long If GetProcAddress(GetModuleHandle("kernel32"), "IsWow64Process") > 0 Then IsWow64Process GetCurrentProcess(), Ret End If Is64bit = (Ret <> 0) End Function Public Function RunProg(Hwnd As Long, Path As String) As Long If Is64bit Then Wow64EnableWow64FsRedirection False RunProg = ShellExecute(Hwnd, "open", Path, vbNullString, GetPath(Path), vbNormalFocus) Wow64EnableWow64FsRedirection True Else RunProg = ShellExecute(Hwnd, "open", Path, vbNullString, GetPath(Path), vbNormalFocus) End If End Function




Reply With Quote