background process?
Hello,
i'd like to know if there is something similar as CreateProcess()?
I was thinking more in external libraries(as SDL or such).
If nothing else, i'd like some links to good tutorials/examples of CreateProcess().
ty
okay, but now that i've created a new process, how do i execute something(for instance, defrag.exe /f)?
Quote:Original post by homeboye
okay, but now that i've created a new process, how do i execute something(for instance, defrag.exe /f)?
// get system settings to create new processSTARTUPINFO info;GetStartupInfo( &info );// process info struct to get infoPROCESS_INFORMATION pinfo;// launch processCreateProcess( NULL, // module name (unused) "defrag.exe /f", // command line NULL, // process attributes NULL, // thread attributes FALSE, // inherits handle? NORMAL_PRIORITY_CLASS, // thread priority NULL, // environment NULL, // current directory &info, // startup info &pinfo // process info);
Note that the command-line argument is automagically executed when you call the function.
ShellExecute(HWND(), char(), "defrag", "-f c:", char(), SW_NORMAL);
Shorter, no? - Though of course, with CreateProcess you get more options, but if you're just looking for something simple, I guess ShellExecute will suit you just fine.
Shorter, no? - Though of course, with CreateProcess you get more options, but if you're just looking for something simple, I guess ShellExecute will suit you just fine.
Quote:Original post by raz0r
ShellExecute(HWND(), char(), "defrag", "-f c:", char(), SW_NORMAL);
Shorter, no?
Just to satisfy my own curiosity (because MSDN isn't exactly that descriptive); but does that execute defrag in a separate process? (ie, would the above call block until the disk was defragged?) I guess the choice of function, inevitably, comes down to the desired usage.
EDIT (in response to the response to this post because I'm too lazy to make a new post): Hooray!
Quote:
Just to satisfy my own curiosity (because MSDN isn't exactly that descriptive); but does that execute defrag in a separate process?
Of course.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement