hi all,
i have a basic c++ knowledge and was wondering how to restart a process if crashed or ended.
for example i want a virtualbox run in the background this is what i have so far
im thinking maybe a basic loop that checks the process[virtualbox.exe] to see if its still alive or not if not recall the same shellex command..Code:#include <windows.h> #include <iostream> using namespace std; int main() { const char* app = "virtualbox.exe"; ShellExecute(GetDesktopWindow(), "open", app, "--startvm \"OpenSuseServer\"", "c:\\program files\\oracle\\virtualbox", SW_HIDE); for (int i = 1; i > 0; i++) { Sleep(6000000); } }
i have done some searching about getting the pid and check it to see if its still active butevery sample code i have gotten from the web didnt compile properly and a little confusing..
any help would be appreciated.. my comipler is GNU compiler using Code:Blocks..
thankx




Reply With Quote