Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help updating a registry key with hex value

Status
Not open for further replies.

meckeard

Programmer
Aug 17, 2001
619
US
Hi all,

I've searched the site and google but can't seem to find a way to update a registry key with a hex value.

The variable called 'strNewValue' holds my hex value (hex:84,11,00,00). This causes a type mismatch error but I can't honestly say I know what the issue is.

I've tried multiple ways to accomplish this but none work.

Any advice?

Here is my code:

const HKEY_CURRENT_USER = &H80000001
strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

strKeyPath = "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\13dbb0c8aa05101a9bb000aa002fc45a"
strkeyvalue = "00036601"
strNewValue = "hex:84,11,00,00"
oReg.CreateKey HKEY_CURRENT_USER,strKeyPath
oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strKeyValue,strNewValue


wscript.echo "success!
 
What about this ?
strNewValue = &H84110000

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I'm getting the following error when I try that:

c:\test.vbs(11, 1) SWbemObject: Type mismatch

Here's the updated line:

strNewValue = "&H84110000
 
That is not what PHV said to try:

strNewValue = [red]"[/red]&H84110000[red]"[/red]

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Ah, gotcha. I was thinking it needs to be set as a string.

It looks as though worked. I'll check the registry to verify.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top