
这个不用说了直接上代码其实是不想解释了#includebits/stdc.h#includewindows.husingnamespacestd;intmain(){while(1){coutendl;cout Windows 小白工具 endl;coutendl;cout 1. 立即关机endl;cout 2. 立即重启endl;cout 3. 睡眠endl;cout 4. 注销endl;cout 5. 定时关机endl;cout 6. 定时重启endl;cout 7. 打开控制面板endl;cout 8. 打开屏幕键盘endl;cout 9. 打开设置endl;cout 10.清空垃圾桶endl;cout 11. 退出endl;coutendl;cout请选择功能(1-11): ;string n;getline(cin,n);if(n1){intt;cout设置关机倒计时(秒): ;cint;cin.ignore();string mess系统将在 to_string(t) 秒后关机确认继续;MessageBox(NULL,mess.c_str(),警告,MB_OKCANCEL|MB_ICONWARNING);string cmdshutdown /s /t to_string(t);system(cmd.c_str());cout系统将在 t 秒后关机...endl;}elseif(n2){intt;cout设置重启倒计时(秒): ;cint;cin.ignore();string mess系统将在 to_string(t) 秒后重启确认继续;MessageBox(NULL,mess.c_str(),警告,MB_OKCANCEL|MB_ICONWARNING);string cmdshutdown /r /f /t to_string(t);system(cmd.c_str());cout系统将在 t 秒后重启...endl;}elseif(n3){system(shutdown /h);cout系统即将进入睡眠...endl;}elseif(n4){system(shutdown /l);cout正在注销用户...endl;}elseif(n5){inth,m;cout请输入定时关机的时间(小时 分钟如 23 30): ;cinhm;cin.ignore();time_t nowtime(0);structtm*tm_infolocaltime(now);tm_info-tm_hourh;tm_info-tm_minm;tm_info-tm_sec0;time_t targetmktime(tm_info);if(targetnow){target24*3600;}longsecondstarget-now;cout定时关机已设置将在 seconds 秒后关机endl;cout按 Enter 取消或等待倒计时结束...endl;time_t starttime(0);boolcancelledfalse;while(time(0)-startseconds){if(GetAsyncKeyState(VK_RETURN)0x8000){cancelledtrue;break;}Sleep(1000);longremainingseconds-(time(0)-start);if(remaining%600||remaining10){cout\r剩余 remaining 秒...flush;}}coutendl;if(cancelled){cout定时关机已取消endl;}else{system(shutdown /s /f /t 0);}}elseif(n6){inth,m;cout请输入定时重启的时间(小时 分钟如 23 30): ;cinhm;cin.ignore();time_t nowtime(0);structtm*tm_infolocaltime(now);tm_info-tm_hourh;tm_info-tm_minm;tm_info-tm_sec0;time_t targetmktime(tm_info);if(targetnow){target24*3600;}longsecondstarget-now;cout定时重启已设置将在 seconds 秒后重启endl;cout按 Enter 取消或等待倒计时结束...endl;time_t starttime(0);boolcancelledfalse;while(time(0)-startseconds){if(GetAsyncKeyState(VK_RETURN)0x8000){cancelledtrue;break;}Sleep(1000);longremainingseconds-(time(0)-start);if(remaining%600||remaining10){cout\r剩余 remaining 秒...flush;}}coutendl;if(cancelled){cout定时重启已取消endl;}else{system(shutdown /r /f /t 0);}}elseif(n7){system(control);cout已打开控制面板endl;}elseif(n8){system(osk.exe);cout已打开屏幕键盘endl;}elseif(n9){system(start ms-settings:);}elseif(n10){system(powershell -Command Clear-RecycleBin -Force -ErrorAction SilentlyContinue);}elseif(n11){cout感谢使用再见endl;Sleep(1000);return0;}else{cout无效输入请重新选择endl;}coutendl;system(pause);system(cls);}return0;}没有Dev-c的直接看这两个链接纯c版 c/python版