I am trying to use CreateProcess to launch firefox.exe. It works for some applications, such as Explorer.exe, but not for others, such as notepad.exe or firefox.exe.
CreateProcess returns True and Err.LastDllError reports success. I presume the app is opening and then closing again.

My code is:
Private Function SuperShell(ByVal App As String, ByVal WorkDir As String, dwMilliseconds As Long, ByVal _
start_size As enSW, ByVal Priority_Class As enPriority_Class) As Boolean
Dim pclass As Long
Dim sinfo As STARTUPINFO
Dim pinfo As PROCESS_INFORMATION
'Not used, but needed
Dim sec1 As SECURITY_ATTRIBUTES
Dim sec2 As SECURITY_ATTRIBUTES
'Set the structure size
sec1.nLength = Len(sec1)
sec1.lpSecurityDescriptor = 0
sec1.bInheritHandle = True
sec2.nLength = Len(sec2)
sec2.lpSecurityDescriptor = 0
sec2.bInheritHandle = True
sinfo.cb = Len(sinfo)
'Set the flags
sinfo.dwFlags = STARTF_USESHOWWINDOW
'Set the window's startup position
sinfo.wShowWindow = start_size
'Set the priority class
pclass = Priority_Class

'Start the program
If CreateProcess(vbNullString, App, sec1, sec2, False, pclass, 0&, WorkDir, sinfo, pinfo) Then '
'Wait
WaitForSingleObject pinfo.hProcess, dwMilliseconds
SuperShell = True
Else
SuperShell = False
MsgBox WinAPIError(Err.LastDllError), vbExclamation
End If
End Function