Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

.NET Writing binary value to registry, vb.net

views
     
TSshoden
post Apr 3 2009, 03:34 PM, updated 17y ago

Getting Started
**
Junior Member
243 posts

Joined: Jan 2006
Hello sifoo,

A simple question for you but not me. tongue.gif

I got this registry file

CODE

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\AttachmentExecute\{0002DF01-0000-0000-C000-000000000046}]
"Excel.Sheet.8"=hex(0):
"Word.Document.8"=hex(0):
"Excel.Sheet.12"=hex(0):
"Word.Document.12"=hex(0):


I want to write it using vb.net

maybe somebody can help.

I write something like this but not working.

CODE
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\AttachmentExecute\{0002DF01-0000-0000-C000-000000000046}", "Excel.Sheet.8", hex(0), RegistryValueKind.Binary)


notworthy.gif
vickizack
post Apr 6 2009, 03:00 PM

Getting Started
**
Junior Member
246 posts

Joined: Dec 2008


include microsoft script runtime

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.RegWrite "HKEY_LOCAL_MACHINE\\Type", "XXX" , "REG_BINARY"
TSshoden
post Apr 6 2009, 04:57 PM

Getting Started
**
Junior Member
243 posts

Joined: Jan 2006
QUOTE(vickizack @ Apr 6 2009, 03:00 PM)
include microsoft script runtime

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.RegWrite "HKEY_LOCAL_MACHINE\\Type", "XXX" , "REG_BINARY"
*
Thanks for your reply but i'm looking for pure .net code and didn't use any legacy object/reference.

Anyone?
liquor1
post Apr 10 2009, 01:30 PM

Getting Started
**
Junior Member
142 posts

Joined: Feb 2007
From: Puchong


CODE

Dim val(0) As Byte
val(0) = 0
Dim regKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows\Shell\AttachmentExecute\{0002DF01-0000-0000-C000-000000000046}")
regKey.SetValue("Excel.Sheet.8", val, Microsoft.Win32.RegistryValueKind.Binary)
regKey.Flush()
regKey.Close()


if u wan to set binary value... u use byte array

 

Change to:
| Lo-Fi Version
0.0129sec    1.06    5 queries    GZIP Disabled
Time is now: 14th December 2025 - 10:13 AM