Thread: RegDeleteValue not deleting the value

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    100

    RegDeleteValue not deleting the value

    Hi all,

    I have a value in the registry of type REG_SZ in the key HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\ CurrentVersion\\Run

    The registry entry looks like this.

    Name: MyProg
    Type: REG_SZ
    Data: c:\MyProg.exe

    Now i want to delete this from the registry so ive used the commands

    Code:
    HKEY hKey
    
    RegOpenKeyEx( HKEY_LOCAL_MACHINE,TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"),0, KEY_ALL_ACCESS, &hKey);
    
    RegDeleteValue(hKey,"MyProg");
    RegCloseKey(hKey);
    Is there anything immediately obviously wrong with this?


    I also checked its Error_Success of the RegDeleteValue and it does not return ERROR_SUCCESS so it must not be deleting correctly.

    Thanks for any help

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Try calling GetLastError and looking up the error code.

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    Do you have permissions to delete the key? are you logged into your computer with admin acccount rights?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating and deleting directories and deleting files
    By fguy817817 in forum C Programming
    Replies: 1
    Last Post: 04-08-2009, 07:26 AM
  2. deleting nodes in a linear list
    By sudhanshu_nsit in forum C++ Programming
    Replies: 7
    Last Post: 06-25-2006, 02:00 AM
  3. Deleting dynamically allocated objects
    By Daniel Jurnove in forum C++ Programming
    Replies: 3
    Last Post: 11-07-2002, 03:30 AM
  4. Deleting Records from a structure
    By Simon in forum C Programming
    Replies: 5
    Last Post: 09-11-2002, 11:28 PM
  5. need help deleting a deleting a struct from file
    By Unregistered in forum C Programming
    Replies: 5
    Last Post: 05-20-2002, 05:38 AM