Solved

Write Double Dword to registry?

Posted on 2001-08-20
6
875 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…

710 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