LPARAMETERS tcFileName #DEFINE INFINITE 0xFFFFFFFF LOCAL ARRAY laJunk[1] LOCAL lnRes, lcStartupInfo, lcProcInfo, lnHandle *** Load DLLs if necessary lnRes = ADLLS( laJunk ) IF lnRes = 0 OR NOT ( ASCAN( laJunk, 'GetLastError', 1, -1, 1, 15 ) > 0) *** We don't have the function available DECLARE INTEGER GetLastError IN kernel32 ENDIF IF lnRes = 0 OR NOT ( ASCAN( laJunk, 'CloseHandle', 1, -1, 1, 15 ) > 0) DECLARE INTEGER CloseHandle IN kernel32 INTEGER nHandle ENDIF IF lnRes = 0 OR NOT ( ASCAN( laJunk, 'CreateProcess', 1, -1, 1, 15 ) > 0) DECLARE INTEGER CreateProcess IN kernel32; STRING lpAppName, STRING lpCmdLine, INTEGER lpProcAttr,; INTEGER lpThrAttr, INTEGER bInhHandles, INTEGER dwCrFlags,; INTEGER @lpEnvir, STRING lpCurDir, STRING lpStInfo,; STRING @lpProcInfo ENDIF IF lnRes = 0 OR NOT ( ASCAN( laJunk, 'WaitForSingleObject', 1, -1, 1, 15 ) > 0) DECLARE INTEGER WaitForSingleObject IN kernel32; INTEGER hHandle, INTEGER dwMilliseconds ENDIF *** The STARTUPINFO structure is used with the CreateProcess, *** CreateProcessAsUser, and CreateProcessWithLogonW functions *** to specify the window station, desktop, standard handles, *** and appearance of the main window for the new process. lcStartupInfo = CHR(68) + REPLICATE(CHR(0), 67) *** The PROCESS_INFORMATION structure is filled in *** by the CreateProcess function with information *** about a newly created process and its primary thread. lcProcInfo = REPLICATE(CHR(0), 16) IF CreateProcess( tcFileName, '', 0,0,0,0,0, CURDIR(),; lcStartupInfo, @lcProcInfo) # 0 *** retrieve handle for the new process by converting *** the first four bytes in the structure to a DWORD lnHandle = ASC(SUBSTR(lcProcInfo, 1, 1 ) ) + ; ASC(SUBSTR(lcProcInfo, 2, 1 ) ) * 16^2 + ; ASC(SUBSTR(lcProcInfo, 3, 1 ) ) * 16^4 + ; ASC(SUBSTR(lcProcInfo, 4, 1 ) ) * 16^6 *** Now wait until it is finished WaitForSingleObject ( lnHandle, INFINITE ) CloseHandle( lnHandle ) ELSE MESSAGEBOX( 'Unable to Create Process' + CHR( 13 ) +; "Error code: " + TRANSFORM( GetLastError() ), 16, 'Major WAAHHHHH!!!!' ) ENDIF