#include "stdafx.h"
#include <Windows.h>
#include <WinBase.h>
#include <iostream>
#include <sstream>
#include <conio.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
SECURITY_ATTRIBUTES sap;
HANDLE hwnd;
stringstream linia;
memset(&sap, 0, sizeof(sap));
sap.nLength = sizeof(sap);
sap.bInheritHandle = true;
hwnd = CreateFile ((LPCWSTR)"wyjscie.txt",FILE_ALL_ACCESS, 0 , &sap, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
memset(&si,0,sizeof(si));
si.cb = sizeof(si);
linia << " procespotomny.exe " << (DWORD) hwnd;
CreateProcess ( NULL, (LPWSTR)linia.str().c_str(),
NULL,NULL,TRUE,CREATE_NEW_CONSOLE,NULL,NULL,&si,&pi);
WaitForSingleObject(hwnd,INFINITE);
//zamkniecie uchwytow (procesu, wayku, pliku)
_getch();
return 0;
}
Comments
0 B
|👍
/👎