Thread: Need Help With this Fuction

  1. #1
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138

    Need Help With this Fuction

    Can someone please visit this site and reword to me how to use this function. I want to use it but do not get how to use it and if other functions are needed as well. Also, under value name, do I have to include the entire value name such as software/microsoft/......

    http://msdn.microsoft.com/library/d...egDeleteKey.asp


    Thanx in advance to all you Windows geniuses.




  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    I got a 404 on that link but i guess what you are after is how to use RegDeleteKey

    LONG RegDeleteKey(HKEY , LPCTSTR);

    the first parameter is the main key. Whatever you want in the registry will be a subkey of one of these....

    HKEY_CLASSES_ROOT
    HKEY_LOCAL_MACHINE
    HKEY_USERS
    HKEY_CURRENT_USER
    HKEY_CURRENT_CONFIG
    HKEY_DYN_DATA
    HKEY_PERFORMANCE_DATA

    the second parameter is a pointer to a generic string that identifies the particular subkey of the first parameter that you wish to delete. If you specify a subkey that itself has subkeys then they will be deleted too. If the function succeeds it returns 0. A non zero return value indicates error which you can find out about using GetLastError()

    for instance to cause major registry trouble....
    TCHAR myregkey[] =TEXT("System\\CurrentControlSet");
    LONG mydelregret= RegDeleteKey(HKEY_CURRENT_CONFIG,myregkey);
    if (mydelregret) // time for GetLastError() to see what went wrong

    edit....

    was wrong.... only deletes subkeys on 9x. doesn't on nt,2k or xp
    also forgot TEXT macro in code sample.
    Last edited by Stoned_Coder; 01-23-2002 at 04:08 PM.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    I am so dumb. I misclicked when I copied the link. I meant to give this one. It is a different function and it deletes a value instead of a key(definately not what I wanted to do). In the explanation, it says I have to include the value to be deleted but I was wondering if I had to include the full path name. Thanks for your help.


    http://msdn.microsoft.com/library/de...eleteValue.asp

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help Finding the mode, calling fuction
    By CaliJoe in forum C++ Programming
    Replies: 5
    Last Post: 04-09-2009, 08:50 PM
  2. Einstine calculator
    By Mach_ie in forum C Programming
    Replies: 2
    Last Post: 08-30-2003, 09:37 AM
  3. Enistine program
    By Mac_the vamp in forum C Programming
    Replies: 2
    Last Post: 11-11-2002, 10:56 AM
  4. check for number of days as a fuction?
    By scronge1 in forum C++ Programming
    Replies: 4
    Last Post: 06-24-2002, 06:35 AM
  5. just a fuction problem
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 05-05-2002, 04:01 AM