CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2005
    Posts
    1,828

    Reading registry Win32 SDK

    MFC registry functions doesn't work in Win32 SDK DLL. Can someone show me how I can read registry using pure Win32 SDK?

  2. #2
    Join Date
    Aug 2006
    Posts
    231

    Re: Reading registry Win32 SDK


  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: Reading registry Win32 SDK

    Quote Originally Posted by maverick786us View Post
    MFC registry functions doesn't work in Win32 SDK DLL. Can someone show me how I can read registry using pure Win32 SDK?
    Not sure what you meant by "MFC registry functions", but agree, that can work only with MFC dll.

    Registry Functions
    32-bit and 64-bit Application Data in the Registry
    Victor Nijegorodov

  4. #4
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: Reading registry Win32 SDK

    • "Pure" raw Windows API registry functions are located in Advapi32.dll, according to MSDN documentation.
    • For keeping MFC application settings under HKEY_CURRENT_USER, you can use CWinApp methods like CWinApp::GetProfileString, CWinApp::WriteProfileString, etc.
    • For dealing with HKEY_LOCAL_MACHINE or other registry sections, you can use CRegKey which is an ATL class but can be used in MFC applications, as well.
    • Once you are using MFC and/or ATL, it has no much sense to reinvent the wheel by directly using of "pure" raw Windows API functions (except where is absolutelly necessary).
    • Last but not the least: both MFC and ATL methods ar "pure" as well, as long as they are using "pure" Windows API stuff behind.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  5. #5
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Reading registry Win32 SDK

    One thing that used to be cool about the ATL CRegKey class was that it was a templated class and it didn't require any dependency dll (similar to std::string).

    Not sure if this is still true or not. The msdn docs list atlbase.h as a requirement but no library to link to. That tells me it can operate standalone without any MFC or ATL runtime dependencies.

    I'd try it.

Tags for this Thread

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