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);
			}
上一篇:invoke和begininvoke


下一篇:C#-MessageBox没有获得焦点