Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to read windows registry

how to read windows registry

Scheduled Pinned Locked Moved C / C++ / MFC
helpwindows-admintutorial
4 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    santhosh padamatinti
    wrote on last edited by
    #1

    Hi to all, I am using windows registry. please look the following.

    const char* subkey ="Software\\Microsoft\\Windows NT\\CurrentVersion";

      if(RegOpenKey(HKEY\_LOCAL\_MACHINE,subkey,&hKey)== ERROR\_SUCCESS)
      {
    	  cout<<"register is opened";
      }
      else
      {
    	  cout<<"still not working";
      }
    

    Above one is working correctly. And also displaying the message correctly. But when subkey i written like follows it is not working.

    const char* subkey ="Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows Messaging Subsystem";

    I am not getting the exact problem please address the solution.... Thanks in advance.....

    To invent something, you need a mountain of junk in your mind. ---------------------Thomas alva edison

    S D 2 Replies Last reply
    0
    • S santhosh padamatinti

      Hi to all, I am using windows registry. please look the following.

      const char* subkey ="Software\\Microsoft\\Windows NT\\CurrentVersion";

        if(RegOpenKey(HKEY\_LOCAL\_MACHINE,subkey,&hKey)== ERROR\_SUCCESS)
        {
      	  cout<<"register is opened";
        }
        else
        {
      	  cout<<"still not working";
        }
      

      Above one is working correctly. And also displaying the message correctly. But when subkey i written like follows it is not working.

      const char* subkey ="Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows Messaging Subsystem";

      I am not getting the exact problem please address the solution.... Thanks in advance.....

      To invent something, you need a mountain of junk in your mind. ---------------------Thomas alva edison

      S Offline
      S Offline
      santhosh padamatinti
      wrote on last edited by
      #2

      Sorry friends , I got the solution. I am reading incorrectly. I am reading in local machine instead of reading current user. Any way it is working thanks......

      To invent something, you need a mountain of junk in your mind. ---------------------Thomas alva edison

      T 1 Reply Last reply
      0
      • S santhosh padamatinti

        Sorry friends , I got the solution. I am reading incorrectly. I am reading in local machine instead of reading current user. Any way it is working thanks......

        To invent something, you need a mountain of junk in your mind. ---------------------Thomas alva edison

        T Offline
        T Offline
        ThatsAlok
        wrote on last edited by
        #3

        You can use ATL class CRegKey to do registry operations

        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
        Never mind - my own stupidity is the source of every "problem" - Mixture

        cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

        1 Reply Last reply
        0
        • S santhosh padamatinti

          Hi to all, I am using windows registry. please look the following.

          const char* subkey ="Software\\Microsoft\\Windows NT\\CurrentVersion";

            if(RegOpenKey(HKEY\_LOCAL\_MACHINE,subkey,&hKey)== ERROR\_SUCCESS)
            {
          	  cout<<"register is opened";
            }
            else
            {
          	  cout<<"still not working";
            }
          

          Above one is working correctly. And also displaying the message correctly. But when subkey i written like follows it is not working.

          const char* subkey ="Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows Messaging Subsystem";

          I am not getting the exact problem please address the solution.... Thanks in advance.....

          To invent something, you need a mountain of junk in your mind. ---------------------Thomas alva edison

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          sampath-padamatinti wrote:

          But when subkey i written like follows it is not working.

          Per MSDN: If RegOpenKey() fails, the return value is a nonzero error code defined in Winerror.h. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          "Man who follows car will be exhausted." - Confucius

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups