Thread: More Registry Crap

  1. #1
    Registered User
    Join Date
    Jan 2002

    More Registry Crap

    I'm busy writing a tool, but things aren't really going as expected in the windows registry area, I'm trying to read a value from the registry. So if there was a key HKEY_CURRENT_USER\Software\Brian\ and a value Mega which contained the string "Rad" I would expect this code to extract the value Rad for me.

    #include <windows.h>
    int WINAPI WinMain (HINSTANCE hi, HINSTANCE hpi, LPSTR arg, int nfs)
      HKEY fdkey;
      char dir[250];
      DWORD cbData = 7;
      RegOpenKey(HKEY_CURRENT_USER, "Software\\Brian", &fdkey);
      RegQueryValue(fdkey, "Mega", dir, NULL);
      return 0;

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Ontario, Canada
    The fourth parameter to RegQueryValue is the size of the buffer denoted in the third parameter.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Registry, Regedit
    By franse in forum C++ Programming
    Replies: 21
    Last Post: 01-29-2009, 09:57 AM
  2. Registry HowTo
    By xxxrugby in forum C Programming
    Replies: 2
    Last Post: 04-10-2005, 10:44 AM
  3. Registry
    By gvector1 in forum C# Programming
    Replies: 0
    Last Post: 07-30-2003, 04:02 PM
  4. LOGFONT struct & Registry :: MFC
    By kuphryn in forum Windows Programming
    Replies: 3
    Last Post: 05-27-2002, 03:38 PM
  5. Registry Access
    By ExDigit in forum Windows Programming
    Replies: 3
    Last Post: 01-04-2002, 04:02 AM