Problem using CreateProcess

BlitzMax Forums/BlitzMax Beginners Area/Problem using CreateProcess

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

Hi,
i know how to use CreateProcess from C but now i wanted to use it from bm

I wrote the following code, but it doesnt work.
Can anybody give me a hint, what is going wrong?

Extern "Win32"
 function CreateProcess (  lpApplicationName$z, lpCommandLine$z, ..
                           lpProcessAttributes, lpThreadAttributes, ..
						   bInheritHandles, dwCreationFlags, lpEnvironment, ..
						   lpCurrentDirectory$z, lpStartupInfo:Byte ptr, ..
						   lpProcessInformation:Byte ptr ) "WIN32" = "CreateProcessA"
 function GetLastError:int () "WIN32"
end extern

type StartUpInfo
field cb:Int
field lpReserved:byte ptr, lpDesktop:byte ptr, lpTitle:byte ptr 'Pointer
field dwX:int, dwY:int, dwXSize:int, dwYSize:Int
field dwXCountChars:int, dwYCountChars:int
field dwFillAttribute:int, dwFlags:Int
field wShowWindow:short, cbReserved2:Short
field lpReserved2:Byte ptr 'PBYTE
field hStdInput:byte ptr, hStdOutput:byte ptr, hStdError:byte ptr
End type

type ProcessInformation
field hProcess:Int, hThread:Int
field dwProcessId:byte ptr, dwThreadId:byte ptr
end type

type TExecuter 

	field FName:String
	field Parameters:String

	field res:int, nhandles:Int
	field handles:Int[2]
	field StartInf:StartUpInfo
	field ProInf:ProcessInformation
	field lasterror:int
	
	method New ()
		StartInf:StartUpInfo	= new StartUpInfo
		StartInf.cb				= sizeof(StartUpInfo)
		print "Size"
		print StartInf.cb
   		ProInf					= new ProcessInformation
	End Method
	
	method Delete ()
		StartInf 	= NULL
		ProInf 		= NULL
	End Method
	

	method Execute (WaitForEnd:int)
		local res:Int
		local appname:String
		
		res = CreateProcess ("","notepad.exe", NULL,NULL,TRUE,NULL,NULL,NULL,StartInf, ProInf)
		print res
		lasterror = GetLastError()
		return(res)
	end method
	
End type


local Ex:TExecuter = new TExecuter

ex.execute(false)

print ex.lasterror