Results 1 to 2 of 2

Thread: run on startup

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Philadelphia
    Posts
    47
    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

  2. #2
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    617

    ...

    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
  •  



Click Here to Expand Forum to Full Width