CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 1999
    Posts
    535

    Check if value in reg exists.. Help!

    I need to see if a value in the registry exists...
    I know how to see if a subkey exists, but not a particular value within' that subkey...
    any help on this would be much appreciated... thanks... Cube


  2. #2
    Join Date
    Aug 1999
    Location
    Denmark
    Posts
    26

    Re: Check if value in reg exists.. Help!

    First open the subkey:

    char myValueData[100];
    DWORD myDataSize;
    LONG myRegResult;
    DWORD myRegType;
    DWORD myOptions = 0;
    myRegResult =::RegOpenKeyEx(HKEY_LOCAL_MACHINE,
    PATH,
    myOptions,
    KEY_ALL_ACCESS,
    &myRegKey);




    and then get the value

    myDataSize = sizeof(myValueData);
    myRegResult = ::RegQueryValueEx(myRegKey,
    "myKey",
    NULL,
    &myRegType,
    (LPBYTE)myValueData,
    &myDataSize);


    CString myValue(myValueData);





    myValue now contains the value of the given key. Hope it helps!!

    Ciao, Jeep


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

Featured