Click to See Complete Forum and Search --> : Creating a new Process


Boumxyz2
September 12th, 2001, 08:53 AM
Dim Ret as Long
Dim Bob as Long
Dim Pro as Long
Dim Sta as STARTUPINFO
Dim Por as PROCESS_INFORMATION
Dim test as string
Dim sec1 as SECURITY_ATTRIBUTES
Dim sec2 as SECURITY_ATTRIBUTES


test = "C:\Windows\Notepad.exe"

Sta.cb = len(Sta)
Sta.lpReserved = vbNull
Sta.dwFlags = STARTF_USESHOWWINDOW
Sta.wShowWindow = SW_SHOWNORMAL
Sta.cbReserved2 = 0
Sta.lpReserved2 = vbNull




'Create a process
Pro = CreateProcess(vbNullString, test, sec1, sec2, false, NORMAL_PRIORITY_CLASS, 0, vbNullString, Sta, Por)
MsgBox (Pro)




I can't make this work. Pro always returns 0 which mean it failed. What am I doing wrong ?

Thanks for your help in advance

Nicolas