code_junkie

Vista not allowing one .exe to call another .exe

Nov 11th, 2011
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. Private Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As Any, lpThreadAttributes As Any, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
  2.  
  3. Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
  4.  
  5. Private Type PROCESS_INFORMATION
  6. hProcess As Long
  7. hThread As Long
  8. dwProcessId As Long
  9. dwThreadId As Long
  10. End Type
  11.  
  12. Private Type STARTUPINFO
  13. cb As Long
  14. lpReserved As String
  15. lpDesktop As String
  16. lpTitle As String
  17. dwX As Long
  18. dwY As Long
  19. dwXSize As Long
  20. dwYSize As Long
  21. dwXCountChars As Long
  22. dwYCountChars As Long
  23. dwFillAttribute As Long
  24. dwFlags As Long
  25. wShowWindow As Integer
  26. cbReserved2 As Integer
  27. lpReserved2 As Long
  28. hStdInput As Long
  29. hStdOutput As Long
  30. hStdError As Long
  31. End Type
  32.  
  33. Dim ProcessInformation As PROCESS_INFORMATION
  34. Dim StartupInformation As STARTUPINFO
  35. Dim ReturnValue As Long
  36. Dim NullString As String
  37. Dim AppPathString As String
  38.  
  39. StartupInformation.cb = Len(StartupInformation)
  40.  
  41. ReturnValue = CreateProcess(NullString, AppPathString, ByVal 0&, ByVal 0&, 1&, NORMAL_PRIORITY_CLASS, ByVal 0&, NullString, StartupInformation, ProcessInformation)
  42. '
  43. 'If you need to wait for the exe to finish
  44. '
  45. Do While WaitForSingleObject(ProcessInformation.hProcess, 0) <> 0
  46. DoEvents
  47. Loop
Add Comment
Please, Sign In to add comment