I addded another function to the WinApi-class. Compile this and it is ok.
Now create a job and try and test it with: // WinApi::createProcess( // null // , "dir/w > c:\\dirtest.txt" // , null // , null // , False // , 0 // , null // , null // , null // , null // );
//This is the added function #WinAPI client server static int createProcess(
str lpApplicationName, // pointer to name of executable module
str lpCommandLine, // pointer to command line string
int lpProcessAttributes, // pointer to process security attributes
int lpThreadAttributes, // pointer to thread security attributes
Boolean bInheritHandles, // handle inheritance flag
int dwCreationFlags, // creation flags
int lpEnvironment, // pointer to new environment block
str lpCurrentDirectory, // pointer to current directory name
int lpStartupInfo, // pointer to STARTUPINFO
int lpProcessInformation // pointer to PROCESS_INFORMATION
)
{
DLL _winShellDLL = new DLL('KERNEL32');
DLLFunction _createProcess = new DLLFunction
(_winShellDLL, 'CreateProcess');
int sizeofSTARTUPINFO = 138;
int _dwX, _dwY, _dwXSize, _dwYSize, _dwXCountChars, _dwYCountChars, _dwFillAttribute, _dwFlags, _wShowWindow, _cbReserved2, _lpReserved2;
int sizeofPROCESSINFORMATION = 26; int _hProcess, _hThread, _dwProcessId, _dwThreadId;
// Initialize the createProcess parameters int hwndAxapta = infolog.hWnd(); Binary _lpApplicationName = new Binary(lpApplicationName); Binary _lpCommandLine = new Binary(lpCommandLine); Binary _lpProcessAttributes = new Binary (lpProcessAttributes); Binary _lpThreadAttributes = new Binary(lpThreadAttributes); Binary _bInheritHandles = new Binary(bInheritHandles); Binary _dwCreationFlags = new Binary(dwCreationFlags); Binary _lpEnvironment = new Binary(lpEnvironment); Binary _lpCurrentDirectory = new Binary(lpCurrentDirectory); Binary _lpStartupInfo = new Binary(lpStartupInfo); Binary _lpProcessInformation= new Binary (lpProcessInformation);
// Initialize the StartupInfo structure
_lpStartupInfo.dWord ( 0, sizeofSTARTUPINFO); //Specifies the size of STARTUPINFO
_lpStartupInfo.binary( 4, null); //Reserved
_lpStartupInfo.binary( 8, null); //lpDesktop
_lpStartupInfo.binary( 12, null); //lpTitle
_lpStartupInfo.dWord ( 16, _dwX); //dwX
_lpStartupInfo.dWord ( 20, _dwY); //dwY
_lpStartupInfo.dWord ( 24, _dwXSize); //dwXSize
_lpStartupInfo.dWord ( 28, _dwYSize); //dwYSize
_lpStartupInfo.dWord ( 32, _dwXCountChars); //dwXCountChars
_lpStartupInfo.dWord ( 36, _dwYCountChars); //dwYCountChars
_lpStartupInfo.dWord ( 40, _dwFillAttribute); //dwFillAttribute
_lpStartupInfo.dWord ( 44, _dwFlags); //dwFlags
_lpStartupInfo.Word ( 48, _wShowWindow); //wShowWindow
_lpStartupInfo.Word ( 52, _cbReserved2); //cbReserved2
_lpStartupInfo.dWord ( 56, _lpReserved2); //lpReserved2
_lpStartupInfo.binary( 60, null); //hStdInput
_lpStartupInfo.binary( 64, null); //hStdOutput
_lpStartupInfo.binary( 68, null); //hStdError
// Initialize the process information structure _lpProcessInformation.dWord( 0, _hProcess); //hProcess _lpProcessInformation.dWord( 4, _hThread); //hThread _lpProcessInformation.dWord( 8, _dwProcessId); //dwProcessId _lpProcessInformation.dWord( 12, _dwThreadId); //dwThreadId
_createProcess.returns(ExtTypes::DWord); // BOOL
_createProcess.arg(ExtTypes::Pointer); // Address of CreateProcess parm block
return _createProcess.call(_lpProcessInformation); }
//thanks in advance, byteway
Yahoo! Groups Sponsor ADVERTISEMENT
click here
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.