xAL
Гость
|
|
« Ответ #1 : 13-11-2004 20:04 » |
|
вот, например, так:
void DosExec(LPSTR lpExeName, BYTE*buffer, DWORD bufsize) { HANDLE hRead, hWrite; SECURITY_ATTRIBUTES sat; STARTUPINFO si; PROCESS_INFORMATION pi; DWORD NumberOfBytesRead; sat.nLength = sizeof(SECURITY_ATTRIBUTES); sat.bInheritHandle = TRUE; CreatePipe(&hRead, &hWrite, &sat, 0); GetStartupInfo(&si); si.hStdOutput = hWrite; si.hStdError = hWrite; si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES; si.wShowWindow = SW_HIDE; CreateProcess(NULL, lpExeName, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi); CloseHandle(hWrite); while(ReadFile(hRead, buffer, bufsize, &NumberOfBytesRead, NULL)); CloseHandle(hRead); }
|