|
-
Nov 1st, 2000, 09:24 AM
#1
Thread Starter
Member
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?
U S A
Visual Studio .NET
Windows XP
-
Nov 1st, 2000, 11:55 AM
#2
Fanatic Member
...
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");
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
|