//Turn off Screen saver if( This-m_bscreensaver) {SystemParametersInfo (spi_setscreensaveactive,false,0,0); BOOLbAct; SystemParametersInfo (Spi_getscreensaveactive,0, &bact,0); if(BACT) {SendText (M_number,"Screen saver disable failed.",1); } Else{sendText (M_number,"screen saver is disabled."); } } //Disable sleep function for power management if( This-M_bpowerman) {SetThreadExecutionState (es_continuous| es_system_required |es_display_required); SendText (M_number,"Power management sleep features are disabled."); } //Set Virtual Memory//Set Resolution if( This-m_bresolution) {DEVMODE dmscreensettings; //Device Modememset (&dmscreensettings,0,sizeof(dmscreensettings));//Make sure the memory is emptied to zeroDmscreensettings.dmsize =sizeof(dmscreensettings);//size of the DEVMODE structureDmscreensettings.dmpelswidth = This->m_sresolutionwidth.toint ();//Selected screen widthDmscreensettings.dmpelsheight = This->m_sresolutionheight.toint ();//Selected Screen Height//Dmscreensettings.dmbitsperpel = M_bitsperpixel; //The color depth selected per pixelDmscreensettings.dmfields = dm_bitsperpel| dm_pelswidth|Dm_pelsheight; //try to set the display mode and return the result, note: Cds_fullscreen removed the status bar if(ChangeDisplaySettings (&dmscreensettings,cds_fullscreen)! =disp_change_successful) { //Setup failedSendText (M_NUMBER,TR ("failed to set resolution"),1);//Set resolution Success}Else{sendText (M_NUMBER,TR ("Set resolution Success"));//Set resolution Success } } //will always be reminded to close the related process until it is closed if( This-M_buninstallkiller) { //Uninstall ChecklistQlist<qstring>lsuninstalllist; Lsuninstalllist.append ("Ravmond.exe");//Rising ProcessLsuninstalllist.append ("Rstray.exe"); Lsuninstalllist.append ("Rsmain.exe"); Lsuninstalllist.append ("Kvmonxp.kxp");//Jiangmin ProcessLsuninstalllist.append ("Kvsrvxp.exe"); Lsuninstalllist.append ("Kvxp.kxp"); Lsuninstalllist.append ("360rp.exe");//360 ProcessLsuninstalllist.append ("360sd.exe"); Lsuninstalllist.append ("360tray.exe"); Lsuninstalllist.append ("ZhuDongFangYu.exe"); Lsuninstalllist.append ("KMService.exe");//Golden Hill Poison PA ProcessLsuninstalllist.append ("Kxescore.exe"); Lsuninstalllist.append ("Kxetray.exe"); Lsuninstalllist.append ("QQPCTray.exe");//Computer Butler ProcessLsuninstalllist.append ("QQPCRTP.exe"); Lsuninstalllist.append ("QQPCMgr.exe"); Qlist<QString>lsprocesslist; while(true) {lsprocesslist.clear (); HANDLE Hprocesssnap=createtoolhelp32snapshot (Th32cs_snapprocess,0); if(hprocesssnap==Invalid_handle_value) { return; } PROCESSENTRY32 pe32; Pe32.dwsize=sizeof(PROCESSENTRY32); //traverse the process snapshot. Display information for each process in turnBOOL Bmore=process32first (hprocesssnap,&pe32); while(bmore) {bmore=process32next (hprocesssnap,&pe32); Lsprocesslist.append (Qstring::fromwchararray (pe32.szexefile)); } //Clear Snapshot ObjectCloseHandle (HPROCESSSNAP); BOOLBflag =true; for(intI=0; I<lsprocesslist.size (); i++){ if(Lsuninstalllist.contains (lsprocesslist.at (i))) {Bflag=false; Custommessagebox::info (Qobject::tr ("Tips"), TR ("discover the processes that need to be closed:") +lsprocesslist.at (i) +tr ("please uninstall."));//discovery process:, please uninstall } } if(Bflag) Break; }}qstring Sapplicationpath=m_lscopylist.at (i). M_sdstpath; Qstringlist List= Sapplicationpath.split (Qregexp ("[\\\\/]")); QString Sapplicationname= list.at (List.size ()-1); if(m_lscopylist.at (i). M_bshortcut) {if(Qfile::link (Sapplicationpath,qstandardpaths::writablelocation (qstandardpaths::D esktoplocation) +"\\"+sapplicationname+". lnk") {emit sendText (M_NUMBER,TR ("The shortcut was set successfully."));//Set Shortcut Success}} qsettings*psettings =Newqsettings (Reg_run, Qsettings::nativeformat); if(m_lscopylist.at (i). M_bautorun) {psettings->setvalue (Sapplicationname, Sapplicationpath.replace ("/","\\")); Emit SendText (M_NUMBER,TR ("set the self-startup item to success."));//set the self-startup item to succeed } Else{psettings-Remove (sapplicationname); } Deletepsettings; //set up direct execution if(m_lscopylist.at (i). M_bexecute) {qprocess*process =Newqprocess; Process-startdetached (m_lscopylist.at (i). M_sdstpath); Emit SendText (M_NUMBER,TR ("The program has started running.")); }
QT 7 qt code for PC settings and software settings