其实昨天就有这个想法了,只是没写出来,今天写出来了
- #include<windows.h>
- #include<fstream>
- using namespace std;
- int WINAPI WinMain(HINSTANCE hinstance,
- HINSTANCE prevInstance,
- PSTR cmdLine,
- int showCmd)
- {
- MessageBox(0, "关机", "浩浩无敌!", MB_OK);
- ofstream fout;
- fout.open("shutdown.bat");
- fout << "c://windows//system32//shutdown -s";
- fout.close();
- ShellExecute(0, "open", "shutdown.bat", "", "", SW_SHOW);
- return 0;
- }