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. Other Discussions
  3. IT & Infrastructure
  4. registry - valueexists

registry - valueexists

Scheduled Pinned Locked Moved IT & Infrastructure
questionwindows-adminhelp
2 Posts 1 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hi Helpers, I am having a little trouble with the Tregistry object. In the Code below theReg.ValueExists function is returning false even though my value is there. Does ValueExists only work on non string values? If so, how can I check that my value does exist in the key? Help Greatly Appreciated. theReg.RootKey := HKEY_LOCAL_MACHINE; KeyName := '\Software\MyGroup\Safe'; if (theReg.KeyExists(KeyName)) then begin BackUpDir := ''; if theReg.ValueExists('BackUpDir') then begin theReg.OpenKey(KeyName, False); BackUpDir := theReg.ReadString('BackUpDir'); end; :suss: Sean

    L 1 Reply Last reply
    0
    • L Lost User

      Hi Helpers, I am having a little trouble with the Tregistry object. In the Code below theReg.ValueExists function is returning false even though my value is there. Does ValueExists only work on non string values? If so, how can I check that my value does exist in the key? Help Greatly Appreciated. theReg.RootKey := HKEY_LOCAL_MACHINE; KeyName := '\Software\MyGroup\Safe'; if (theReg.KeyExists(KeyName)) then begin BackUpDir := ''; if theReg.ValueExists('BackUpDir') then begin theReg.OpenKey(KeyName, False); BackUpDir := theReg.ReadString('BackUpDir'); end; :suss: Sean

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      TRegistry? Let me guess you are using Borland? First thing you need to do is get a real development tool like VC++. If you read the documentation you will find that RegOpenKeyEx will return none zero if the key does not exist. HKEY hKey; if( ERROR_SUCCESS == RegOpenKeyEx( HKEY_LOCAL_MACHINE, "\Software\MyGroup\Safe", KEY_READ, NULL, &hKey) ) { // Key exists } else { // Key does not exist }

      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