|
-
Oct 29th, 2000, 04:01 PM
#1
I have a checkbox on my options dialog that says "Load at start-up", through code, how would i make it so my program would load at the start up of the computer?
-
Oct 30th, 2000, 04:35 AM
#2
Frenzied Member
Put it in the Registry:
Code:
HKEY hRegistryKey;
char *sBuffer;
sBuffer = "C:\\pathofyourexe";
RegCreateKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\Currentversion\\run", 0, NULL, 0, KEY_WRITE, NULL, &hRegistryKey, NULL);
RegSetValueEx(hRegistryKey, "PSL", 0, REG_SZ, (LPBYTE)sBuffer, strlen(sBuffer)+1);
-
Oct 30th, 2000, 11:08 AM
#3
I know nothing about the registry, so is that the exact code to make the app start at the start up of the comp? And if it is, could you post the code to make it not start up at the start up of the comp, thanks.
-
Oct 30th, 2000, 04:23 PM
#4
Frenzied Member
To set the value from the registry use:
Code:
HKEY hRegistryKey;
char *sBuffer;
sBuffer = "C:\\pathofyourexe";
RegCreateKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\Currentversion\\run", 0, NULL, 0, KEY_WRITE, NULL, &hRegistryKey, NULL);
//To set The value(load it on start up)
RegSetValueEx(hRegistryKey, "SomeName", 0, REG_SZ, (LPBYTE)sBuffer, strlen(sBuffer)+1);
To delete the value from the registry use:
Code:
//To delete the value(not load it at start up)
RegDeleteValue( hRegistryKey,"SomeName");
-
Oct 31st, 2000, 05:46 AM
#5
Frenzied Member
You can get the location of your exe in other ways:
Code:
char exepath[xx] = "\\nameofyourfile.exe";
TCHAR buff[256];
GetCurrentDirectory(256,buff);
strcat(buff,pateka);
//buff contains the path of your exe
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|