Solved

Write Double Dword to registry?

Posted on 2001-08-20
6
864 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

911 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

16 Experts available now in Live!

Get 1:1 Help Now