Results 1 to 7 of 7

Thread: Really simple Registry help, ASAP plz

  1. #1

    Thread Starter
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720

    Really simple Registry help, ASAP plz

    "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\TIT"
    In the Run key, it has a value TIT (which holds "hello"). I just want it deleted (using cpp of course).

    This is my current code, problem is that the type of lKeyVal is wrong I think.

    Code:
    #include <windows.h>
    #include <iostream.h>
    
    int main()
    {
    	long rEt;
    	HWND lKeyVal;
    	rEt = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\TIT", lKeyVal);
    	rEt = RegDeleteValue(lKeyVal, "TIT");
    	rEt = RegCloseKey(lKeyVal);
                    return(0);
    }
    asdf

  2. #2
    Addicted Member
    Join Date
    Oct 2002
    Posts
    241
    hWnd is a handle for a window. hKey is what you want.

  3. #3

    Thread Starter
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720
    Ok, this is my code, It does not work.. I don't know why, I passed the reference (PHKEY):

    Code:
    #include <windows.h>
    #include <iostream.h>
    
    int main()
    {
    	long rEt;
    	HKEY PHKEY_X;
    	rEt = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\TIT", &PHKEY_X);
    	rEt = RegDeleteValue(PHKEY_X, "TIT");
    	rEt = RegCloseKey(PHKEY_X);
    return 0;
    }
    asdf

  4. #4
    Addicted Member
    Join Date
    Oct 2002
    Posts
    241
    What errors do you get? Check ret.

  5. #5

    Thread Starter
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720
    2, 6, 6 In that order of rEt being used
    asdf

  6. #6

    Thread Starter
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720
    I am logged in as admin on XP pro.. does that have anything to do with it? maybe if I mess with access rights? but hOw.
    asdf

  7. #7
    Addicted Member
    Join Date
    Oct 2002
    Posts
    241
    Use FormatMessage() in winerror.h to find out what those error numbers mean.

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