I am trying to translate this code snippet docs.microsoft.com into X# or VO. Can someone help? Maybe with parameters STARTUPINFO si and PROCESS_INFORMATION pi?
Here is my code. This code does not compile:
Code: Select all
FUNCTION WaitForProcess(cmd as STRING) as LOGIC
LOCAL si as STARTUPINFO // what is this in X#/VO?
LOCAL pi as PROCESS_INFORMATION // what is this in X#/VO?
LOCAL createProc as LOGIC
LOCAL hProc as ptr
// what is this in X#/VO?
//ZeroMemory( &si, sizeof(si) )
//si.cb = sizeof(si)
//ZeroMemory( &pi, sizeof(pi) )
// Start the child process.
createProc := CreateProcess( null, ; // No module name (use command line)
cmd, ; // Command line
null, ; // Process handle not inheritable
null, ; // Thread handle not inheritable
FALSE, ; // Set handle inheritance to FALSE
0, ; // No creation flags
null, ; // Use parent's environment block
null, ; // Use parent's starting directory
ref si, ; // Pointer to STARTUPINFO structure
ref pi ) // Pointer to PROCESS_INFORMATION structure
IF !createProc
? "Failed to create Process"
return false
ENDIF
WaitForSingleObject(hProc, INFINITE)
CloseHandle( pi.hProcess )
CloseHandle( pi.hThread )