Anyone know the code so that you can make your program run on startup... ie check the run registry key and then add or delete the key if necessary?
Printable View
Anyone know the code so that you can make your program run on startup... ie check the run registry key and then add or delete the key if necessary?
Do not neglect searching this VB-WORLD db
This was once answered by a gentleman named VLATKO
here
"use the registry"
--------------------------------------------------------------------------------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");