hi, i am making a program that kills a process

system("taskkill /im explorer.exe");

and i need to restart the process using CreateProcess.

CreateProcess(NULL,("C:\\WINDOWS\\explorer.exe"), NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &siStartupInfo, &piProcessInfo);

but i keep getting these errors: 27 `siStartupInfo' undeclared (first use this function) and 27 `piProcessInfo' undeclared (first use this function)

any solutions?

Recommended Answers

All 4 Replies

Did you declare siStartupInfo and piProcessInfo?
If so, where in the program did you delcare them?

No I didn't declare them.

STARTUPINFO siStartupInfo = {0};
siStartupInfo.cb = sizeof sif;
siStartupInfo.dwFlags = STARTF_USESHOWWINDOW;
siStartupInfo.wShowWindow = SW_NORMAL;
PROCESS_INFORMATION piProcessInfo = {0};

And an alternate method is recommended by using ShellExecute/ShellExecuted if you don't want to manipulate the new process.

Ok that got it wirking. Thanks for your help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.