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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create DWORD in Registry with FFFFFFFF?

Status
Not open for further replies.

markdmac

MIS
Joined
Dec 20, 2003
Messages
12,340
Location
US
Anybody out here know how to build a registry key as a DWORD and populate it with FFFFFFFF?

VB Integers are only 16 bit and I need to use 32 bit.

I can create the key and fill it with a 0 or a 1 and it stays a DWORD, but if I try to fill it with FFFFFFFF it converts it to a string and makes the key a REG_SZ.

I've already got code that will dynamically create then import a reg file, so my need has been fulfilled, I'm just interested from a technical perspective on how to build the key and fill it with code. Thanks.
 
Try this:
Code:
Sh.RegWrite strValueName, -1, "REG_DWORD"

Hope This Help
PH.
 
Thanks PH, but read the last part of my problem. I can create the key just fine. I can populate it even with a value, but nothing above the 16 bit mark. The key is to poulate it with FFFFFFFF. If you know of a way please let me know. Your example above will not do that, this is exactly what I was trying to get to work but WSH has a limit apparently built into it.
 
This is the whole script I tested successfully on my Win98 and WinXP boxes:
Set Sh=WScript.CreateObject("WScript.Shell")
Sh.RegWrite "HKCU\Software\ACME\FortuneTeller\", 1, "REG_BINARY"
Sh.RegWrite "HKCU\Software\ACME\FortuneTeller\MindReader", -1, "REG_DWORD"
WScript.Quit
Then, in regedit, the value was 0xffffffff.

Hope This Help
PH.
 
Hello markdmac,

Look at the difference on the rendering of the two test valuenames.
Code:
dim wsh
set wsh=createobject("wscript.shell")
dwValue=&HFFFFFFFF
sName="HKEY_CURRENT_USER\enduser_testing\testentry"
sName2="HKEY_CURRENT_USER\enduser_testing\testentry2"
sName3="HKEY_CURRENT_USER\enduser_testing\testentry3"

wsh.regwrite sName,dwValue,"REG_DWORD"
wsh.regwrite sName2,dwValue,"REG_BINARY"
wsh.regwrite sName3,clng(dwValue),"REG_BINARY"

set wsh=nothing
The rendering through sName3 is the one you're looking for.

regards - tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top