Based on the
MSDN page for Creating Processes, here is a super simple way to demonstrate starting another application from QB64 using the Win32 API function set. The below code uses all functions used in the MSDN example. It is designed to be compiled as a console application and ran from CMD or PowerShell. You will pass it the name or full path of another executable to run as the argument.
As Long dwX
, dwY
, dwXSize
, dwYSize
, dwXCountChars
, dwYCountChars
, dwFillAttribute
, dwFlags
As _Offset lpReserved2
, hStdInput
, hStdOutput
, hStdError
Const INFINITE
= 4294967295
Dim As PROCESS_INFORMATION pi
printf2
"CreateProcess failed (%d)." + Chr$(10) + Chr$(0), GetLastError
WaitForSingleObject pi.hProcess, INFINITE
CloseHandle pi.hProcess
CloseHandle pi.hThread