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#
  4. Registry Values

Registry Values

Scheduled Pinned Locked Moved C#
windows-adminhelptutorial
3 Posts 3 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.
  • C Offline
    C Offline
    CodeItWell
    wrote on last edited by
    #1

    I need this registry values to insert. "ValueName"=hex:fd,d5,72,d6,8b,6a,8a,6f,d5,33,95,fd" But i only know how to insert a string values. Help.

    Vasildb

    M L 2 Replies Last reply
    0
    • C CodeItWell

      I need this registry values to insert. "ValueName"=hex:fd,d5,72,d6,8b,6a,8a,6f,d5,33,95,fd" But i only know how to insert a string values. Help.

      Vasildb

      M Offline
      M Offline
      Martin 0
      wrote on last edited by
      #2

      Hello Vasildb, I think you have to convert your HEX string too int32. If you have .Net >1.1 you can use Int32.TryParse.

      public Int32 HexToInt32(string hexString, Int32 default)
      {
      Int32 actvalue;
      if(Int32.TryParse(hexString, System.Globalization.NumberStyles.HexNumber, CultureInfo.CurrentCulture, out actvalue))
      {
      return actvalue;
      }
      else
      {
      return default;
      }
      }

      //Call the method like this
      Int32 actvalue = HexToInt32("fd", 0);
      if(actvalue!=null)
      {
      YourRegKey.SetValue("Name", actvalue);
      }

      Have not testet it, so I hope it works for you. All the best, Martin

      1 Reply Last reply
      0
      • C CodeItWell

        I need this registry values to insert. "ValueName"=hex:fd,d5,72,d6,8b,6a,8a,6f,d5,33,95,fd" But i only know how to insert a string values. Help.

        Vasildb

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        In .NET 1.x you could only read/write strings (REG_SZ entries) in the registry with the managed classes (RegistryKey). For other entry types (such as REG_DWORD) you had to use PInvoke. Since .NET 2.0 there is also support for the other entry types, through the new RegistryValueKind enum, and new methods in RegistryKey class such as RegistryKey.GetValueKind() :)

        Luc Pattyn

        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