app关闭进程启动
作者:互联网
关闭电源事件函数
SYMessageBox * messageBox = new SYMessageBox(this, "", CHS("退出系统并关闭电源?"), 2);
messageBox->showFullScreen();
if (messageBox->exec() == 2)
{
qApp->quit();
STARTUPINFOA si = { 0 }; //
si.cb = sizeof(si);
si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
si.hStdError = (HANDLE)2;
si.hStdInput = (HANDLE)0;
si.hStdOutput = (HANDLE)1;
// si.wShowWindow = SW_HIDE;
PROCESS_INFORMATION pi;
CreateProcessA(
0,
(LPSTR)"C:/Windows/System32/shutdown.exe -s -t 0",// -t 0
0,
0,
TRUE,
0,
0,
0,
&si, &pi);
}
标签:messageBox,HANDLE,app,关闭电源,si,关闭,进程,SYMessageBox,pi 来源: https://blog.csdn.net/qq_40239482/article/details/100187735