Hello everybody
I’ve been developing window applications with Xojo 2013.r4.1 ff. Working with release 2014r3.2 I’ve encountered a problem having to do with creating processes. I tried to create a simple process such as Windows Notepad just to start the program by Windows API CreateProcessA. This fails with error code 123 no matter if I pass the process name in the first argument (AppName) or the following one (AppArgs) while in former releases the process was created without problems. Does anyone know what has changed in this release and what I’m doing wrong now? I can provide an excerpt of the used code:
Soft Declare Function CreateProcess Lib “kernel32.dll” Alias “CreateProcessA” ( lpApplicationName As CString, lpCommandLine As CString, _
lpProcessAttributes As Ptr, lpThreadAttributes As Ptr, bInheritHandles As Boolean, dwCreationFlags As integer, lpEnvironment As Ptr, _
lpCurrentDirectory As CString, lpStartupInfo As Ptr, lpProcessInformation As Ptr) As Boolean
dim bRes as Boolean
Const SW_SHOWNORMAL = 1
Const SW_HIDE = 0
Const SW_MINIMIZE = 6
Const STARTF_USESHOWWINDOW = &h00000001
dim ProcInfo as new MemoryBlock(16)
dim StartInfo as new MemoryBlock(64)
StartInfo.Int32Value( 0 ) = StartInfo.Size ’ cb = length of buffer
StartInfo.Int32Value( 44 ) = STARTF_USESHOWWINDOW ’ dwFlags
StartInfo.Int16Value( 48 ) = SW_SHOWNORMAL ’ show window normally
bRes = CreateProcess( Nil, “C:\Windows\otepad.exe”, Nil, Nil, False, 0, Nil, Nil, StartInfo, ProcInfo)
This line doesn’t provide a different result either:
bRes = CreateProcess( “C:\Windows\otepad.exe”, “”, Nil, Nil, False, 0, Nil, Nil, StartInfo, ProcInfo)
The function always returns false and an API call GetLastError retrieves 123.
Thanks in advance.
Greetz
Peter