Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

How to create a process (CreateProcess usage)

I trying to start an .exe from my VBA code but I can't for now. Can somebody help me? This is my source, where is a error?

Private Type sinfo
cb As Long
lpReserved As Object
lpDesktop As Object
lpTitle As Object
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Object
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type

Private Type pinfo
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadId As Long
End Type

Dim temp1 As Variant
Dim pifoto As pinfo
Dim sifoto As sinfo
temp1 = CreateProcess("C:\Documents and Settings\Administrator\Desktop\notepad.exe", Null, Null, Null, _
False, 0, Null, Null, sifoto, pifoto)
[1050 byte] By [hotmar] at [2007-11-11 7:14:51]
# 1 Re: How to create a process (CreateProcess usage)
You didn't include your declaration for the CreateProcess function, but the lp... elements of the STARTUPINFO structure should be Longs or Strings, not Object. See http://support.microsoft.com/kb/q178116/ for a working example.
Phil Weber at 2007-11-11 17:27:15 >
# 2 Re: How to create a process (CreateProcess usage)
The fastest way to finish one job is to know where to read the solution. The second way is to ask the right man where to read the solution:) Thank you!!!
hotmar at 2007-11-11 17:28:15 >