Zadatak: *a) *promijeni program *w_primjer_01.c* tako da se proces *notepad.exe* terminira nakon 10 sekundi Rijesenje: - Dodan je timer koji ceka 10 sekundi i nakon toga ugasi proces ... Source code: #define _WIN32_WINNT 0X0500 #include #include #include int main() { HANDLE hTimer = NULL; STARTUPINFO si; PROCESS_INFORMATION pi; LARGE_INTEGER liDueTime; UINT uiExitCode; GetStartupInfo(&si); printf("Running Notepad with CreateProcess\n"); CreateProcess(NULL, "notepad", // Name of app to launch NULL, // Default process security attributes NULL, // Default thread security attributes FALSE, // Don't inherit handles from the parent 0, // Normal priority NULL, // Use the same environment as the parent NULL, // Launch in the current directory &si, // Startup Information &pi); // Process information stored upon return printf("Done.\n"); liDueTime.QuadPart = -100000000; // Set up a 10 second timer object hTimer = CreateWaitableTimer(NULL, TRUE, "WaitableTimer"); SetWaitableTimer(hTimer, &liDueTime, 0, NULL, NULL, 0); // Now wait for the alarm printf("waiting for alarm\n"); // Wait for the timer object WaitForSingleObject(hTimer, INFINITE); // Terminate process TerminateProcess(pi.hProcess, uiExitCode); return 0; }