In BP there is the function CreateProcess(Path$).
Is in BMX anything like that, too?
If not, I'll try to write a module containing it myself.
Is in BMX anything like that, too?
If not, I'll try to write a module containing it myself.
'First of all, thanks a lot to all of you! 'It really helps! 'Sorry for late answering but I found some functions which may help: Extern "Win32" 'Sorry only usable on win32 Function WinExec ( Cmd:Byte Ptr , Show ) Function ShellExecuteA ( Wnd , Cmd:Byte Ptr , File:Byte Ptr , Params:Byte Ptr , Dir:Byte Ptr , Show ) Function CreateProcessA ( App:Byte Ptr , Cmd:Byte Ptr , PrAt , ThAt , InHandels , Flags , Env:Byte Ptr , Dir:Byte Ptr , S , P ) EndExtern 'The last of them is very intressting but not easy not understand ( as I think ). 'ShellExecuteA(...) seems to be equal to ExecFile(Path$) in BB.
#include <windows.h> int WinGetStartupInfo ( void * Info ) { GetStartupInfo ( Info ) ; return 0 ; }
Strict Import "CreateProcess.c" Local Stream:TStream = CreateProcess ( "calc.exe" ) Delay 10000 While Not Eof ( Stream ) Print ReadLine ( Stream ) Wend Function CreateProcess:TStream ( Cmd$ ) ?Win32 Local Stream:TProcessStream = New TProcessStream Stream.ProcInfo = New TProcInfo Stream.StartInfo = New TStartInfo ' Stream.StartInfo.Size = SizeOf Stream.StartInfo DebugStop Print WinGetStartupInfo ( Stream.StartInfo ) Print WinCreatePipe ( Varptr Stream.In , Varptr Stream.StartInfo.StdOutput , Null , 0 ) Print WinCreatePipe ( Varptr Stream.StartInfo.StdInput , Varptr Stream.Out , Null , 0 ) Stream.StartInfo.StdError = Stream.StartInfo.StdOutput Print WinCreateProcess ( "".ToCString ( ) , Cmd.ToCString ( ) , Null , Null , False , 0 , Null , Null , Stream.StartInfo , Stream.ProcInfo ) Return Stream Type TProcInfo Field Process Field Thread Field ProcessId Field ThreadId EndType Type TStartInfo Field Size Field Reserved1 Field Desktop Field Title Field X Field Y Field XSize Field YSize Field XCountChars Field YCountChars Field FillAttribute Field Flags Field ShowWindow:Short Field Reserved2:Short Field Reserved3:Byte Field StdInput Field StdOutput Field StdError Field Test:Long EndType Type TProcessStream Extends TStream Field In Field Out Field StartInfo:TStartInfo Field ProcInfo:TProcInfo Method Eof ( ) EndMethod EndType Extern "C" Function WinGetStartupInfo ( StartInfo:TStartInfo ) EndExtern Extern "Win32" Function WinCreatePipe ( ReadPipe Ptr , WritePipe Ptr , PipeAttributes:Byte Ptr , Size ) = "CreatePipe@16" Function WinCreateProcess ( App:Byte Ptr , Cmd:Byte Ptr , PrAt:Byte Ptr , ThAt:Byte Ptr , IH , Flags , Env:Byte Ptr , Dir:Byte Ptr , S:TStartInfo , P:TProcInfo ) = "CreateProcessA@40" Function WinReadFile ( File , Buffer:Byte Ptr , ReadLen , BytesRead Ptr , Overlapped:Byte Ptr ) = "ReadFile" Function WinWriteFile ( File , Buffer:Byte Ptr , WriteLen , BytesWritten Ptr , Overlapped:Byte Ptr ) = "WriteFile" Function WinCloseHandle ( Handle , abc ) = "CloseHandle" EndExtern ? system_ Cmd EndFunction