Solved

Write Double Dword to registry?

Posted on 2001-08-20
6
859 Views
Last Modified: 2012-08-13
I need to write a double-long dword value to the registry from a VB app.  I am using a modregistry.bas file from the following link http://www.freevbcode.com/code/mkcRegistry.zip
which allows me to add normal long variables to the registry without any problem.  Unfortunately I have been unable to modify this module to add double-long integers.

Anyone know how to do this or know of any code that does this?
0
Comment
Question by:begreening
6 Comments
 
LVL 4

Expert Comment

by:aponcealbuerne
ID: 6408029
Hi
check for the RegSetValueEx function
Hope helps
0
 
LVL 3

Expert Comment

by:nzjonboy
ID: 6408094
this link gives a breakdown of the types you can have in the registry

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/hh/sysmgmt/regapi_41mb.asp

I am guessing you want to use a REG_QWORD (64 bit) value?

Open the module code and look for the declaration

Public Enum KeyType
  [REG_BINARY] = 3 'A non-text sequence of bytes
  [REG_DWORD] = 4 'A 32-bit integer...visual basic data type of Long
  [REG_SZ] = 1 'A string terminated by a null character
End Enum

This is where you should add the new type. Then just call, as you would normally, the read/write/delete/export functions with the new key type.

hope this helps

nzjonboy
0
 
LVL 1

Author Comment

by:begreening
ID: 6409892
Microsoft Media uses the following sentax for their registry entries.  

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\nsunicast\Parameters\Virtual Roots\/PubName]
"Path"="d:\\clients\\Company"
"MaxBandwidth"=dword:ffffffff
"MaxClients"=dword:ffffffff

If you open this key the value in hex is ffffffff.  When you switch to binary, the value is 4,294,967,295.  The code I have for adding values to the registry takes a string variable of the binary number and converts in to a long integer with the CLng function for it input into the RegSetValueEx function.  A long variable can only pass an integer as large as 2,147,483,648, which is exactly half of the number that Microsoft needs.  I tried replacing the CLng function with the CDbl function but this does not work, it puts zero values in the registry.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Author Comment

by:begreening
ID: 6409987
I guess another solution would be to output a text file (with .reg ext) with the registry entry like above and then merge it somehow.

Anyone have working code for either method?  
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6410765
I used last comment from you with success, but unfortunatelly, with strings only.
Anyway, i think that shouldn't be problems.
.....
"and then merge it somehow."

shell "regedit.exe /e /y " & "c:\myreg.reg",vnhide
0
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 200 total points
ID: 6410824
Sorry...!!!

shell "regedit /s " & "c:\myfile.reg", vbhide
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now