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. delete registry key values

delete registry key values

Scheduled Pinned Locked Moved C / C++ / MFC
c++windows-admin
9 Posts 6 Posters 0 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.
  • M Offline
    M Offline
    Madan Chauhan
    wrote on last edited by
    #1

    Hi all, I need to delete registry key values in VC++. I want to delete the values of :: HKLM->SYSTEM->MountedDevices Please suggest me by providing the code hints. Thanks.

    J K R H 4 Replies Last reply
    0
    • M Madan Chauhan

      Hi all, I need to delete registry key values in VC++. I want to delete the values of :: HKLM->SYSTEM->MountedDevices Please suggest me by providing the code hints. Thanks.

      J Offline
      J Offline
      Joseph Marzbani
      wrote on last edited by
      #2

      Try CReg class within ATL. It offers you so many handy functions. :rose:

      1 Reply Last reply
      0
      • M Madan Chauhan

        Hi all, I need to delete registry key values in VC++. I want to delete the values of :: HKLM->SYSTEM->MountedDevices Please suggest me by providing the code hints. Thanks.

        K Offline
        K Offline
        kapardhi
        wrote on last edited by
        #3

        hello this may help you! Try it! To delete the value and the key it self ::RegDeleteKey((HKEY)hKey,(LPCWSTR)szKey); here HKEY is HKLM szKey is resst of the path i.e SYSTEM->MountedDevices to delete value of key open the path OpenKey (LPCTSTR hKey, LPCTSTR szKey) here HKEY is HKLM szKey is resst of the path i.e SYSTEM->MountedDevices then RegDeleteValue(mhKey,(LPCWSTR)lpValueName) i hope this will work

        M 1 Reply Last reply
        0
        • M Madan Chauhan

          Hi all, I need to delete registry key values in VC++. I want to delete the values of :: HKLM->SYSTEM->MountedDevices Please suggest me by providing the code hints. Thanks.

          R Offline
          R Offline
          Rane
          wrote on last edited by
          #4

          You may use RegDeleteValue function!.

          RegDeleteValue(hOpenKey, // handle to open registry key
          sValueName); // string containing value name to delete

          Regards, Rane

          M 1 Reply Last reply
          0
          • K kapardhi

            hello this may help you! Try it! To delete the value and the key it self ::RegDeleteKey((HKEY)hKey,(LPCWSTR)szKey); here HKEY is HKLM szKey is resst of the path i.e SYSTEM->MountedDevices to delete value of key open the path OpenKey (LPCTSTR hKey, LPCTSTR szKey) here HKEY is HKLM szKey is resst of the path i.e SYSTEM->MountedDevices then RegDeleteValue(mhKey,(LPCWSTR)lpValueName) i hope this will work

            M Offline
            M Offline
            Madan Chauhan
            wrote on last edited by
            #5

            Thanks for replying, I need to delete all values of MountedDevices key. So To delete them one by one I need to put it in to a loop, so how can I know the no of values that are there. RegDeleteValue(mhKey,(LPCWSTR)lpValueName) in this function lpValueName I need to pass the value name one by one. But I want to delete all values so that it will take the next value itself. Thanks.

            K D 2 Replies Last reply
            0
            • R Rane

              You may use RegDeleteValue function!.

              RegDeleteValue(hOpenKey, // handle to open registry key
              sValueName); // string containing value name to delete

              Regards, Rane

              M Offline
              M Offline
              Madan Chauhan
              wrote on last edited by
              #6

              Thanks for replying, I need to delete all values of MountedDevices key. So To delete them one by one I need to put it in to a loop, so how can I know the no of values that are there. RegDeleteValue(mhKey,(LPCWSTR)lpValueName) in this function lpValueName I need to pass the value name one by one. But I want to delete all values so that it will take the next value itself. Thanks.

              1 Reply Last reply
              0
              • M Madan Chauhan

                Hi all, I need to delete registry key values in VC++. I want to delete the values of :: HKLM->SYSTEM->MountedDevices Please suggest me by providing the code hints. Thanks.

                H Offline
                H Offline
                Hamid Taebi
                wrote on last edited by
                #7

                And see here[^].

                1 Reply Last reply
                0
                • M Madan Chauhan

                  Thanks for replying, I need to delete all values of MountedDevices key. So To delete them one by one I need to put it in to a loop, so how can I know the no of values that are there. RegDeleteValue(mhKey,(LPCWSTR)lpValueName) in this function lpValueName I need to pass the value name one by one. But I want to delete all values so that it will take the next value itself. Thanks.

                  K Offline
                  K Offline
                  kapardhi
                  wrote on last edited by
                  #8

                  Better delete the whole key and then create it with new sub keys but having same old names

                  1 Reply Last reply
                  0
                  • M Madan Chauhan

                    Thanks for replying, I need to delete all values of MountedDevices key. So To delete them one by one I need to put it in to a loop, so how can I know the no of values that are there. RegDeleteValue(mhKey,(LPCWSTR)lpValueName) in this function lpValueName I need to pass the value name one by one. But I want to delete all values so that it will take the next value itself. Thanks.

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

                    Madan Chauhan wrote:

                    I need to delete all values of MountedDevices key.

                    Have you considered RegDeleteKey()?

                    Madan Chauhan wrote:

                    So To delete them one by one I need to put it in to a loop, so how can I know the no of values that are there.

                    Did you search MSDN? Look for RegEnumValue().

                    "Love people and use things, not love things and use people." - Unknown

                    "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                    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