|
-
June 29th, 2001, 09:35 AM
#1
VB 6.0 and Registry System.
Hi, we are working with VB 6.0 and WIN 98, we need to catch a value from a key of the pc registry system. This value is a name of a driver informix that in different pcs it can be different ... This is necesary in order to prepare a string of connection without data sources names in ODBC ...
Can anybody help us ???
Thaks in advance, and regards from Chile.
-
June 29th, 2001, 09:50 AM
#2
Re: VB 6.0 and Registry System.
here the code how to read registry
'PLACE ALL THIS INTO A NEW MODULE or IN Declarations OF YOUR FORM
Public Sub CreateKey(Folder As String, Value As String)
Dim b As Object
On Error Resume Next
Set b = CreateObject("wscript.shell")
b.RegWrite Folder, Value
End Sub
Public Sub CreateIntegerKey(Folder As String, Value As Integer)
Dim b As Object
On Error Resume Next
Set b = CreateObject("wscript.shell")
b.RegWrite Folder, Value, "REG_DWORD"
End Sub
Public Function ReadKey(Value As String) As String
'READ FROM WINDOWS REGISTRY
'.........................
Dim b As Object
On Error Resume Next
Set b = CreateObject("wscript.shell")
r = b.RegRead(Value)
ReadKey = r
End Function
Public Sub DeleteKey(Value As String)
'DELETE VALUES FROM WINDOWS REGISTRY
'-----------------------------------
Dim b As Object
On Error Resume Next
Set b = CreateObject("Wscript.Shell")
b.RegDelete Value
End Sub
'form==============
'To Create an registry key:
CreateKey "HKEY_CURRENT_USER\Software\My Software\Version","1.45"
'To Create an Integer registry key:
CreateIntegerKey "HKEY_CURRENT_USER\Software\My Software\Number","50"
'To Read from the registry
msgbox "Version is " & ReadKey("HKEY_CURRENT_USER\Software\My Software\Version"
'To Delete from the registry
DeleteKey "HKEY_CURRENT_USER\Software\My Software\Version"
' Instead of writing out HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER etc, you can
' use abbreviations such as "HKCU\Software"
Iouri Boutchkine
[email protected]
-
June 29th, 2001, 11:30 AM
#3
Re: VB 6.0 and Registry System.
Thank you very much. It really works !!!
And one more thing ... How do you catch a list of items or entries for a registry system Path ??? Is there any manner ... ?
Thanks again.
-
June 29th, 2001, 11:50 AM
#4
Re: VB 6.0 and Registry System.
First of all, rate it if it helped you.
2.I really did not understand what you mean by catching the list of items for a registry system path.
Iouri Boutchkine
[email protected]
-
June 29th, 2001, 02:29 PM
#5
Re: VB 6.0 and Registry System.
Thanks for your answer.
We already have done to work your previous module and it runs without problems. We are going to use it. Now we need to get the keys below other key. Specifically:
"HKEY_LOCAL_MACHINE\Software\ODBC\ODBCINST.INI".
Do you understand me?
Thanks.
-
July 4th, 2001, 03:19 PM
#6
Re: VB 6.0 and Registry System.
Finally, we used a module included in an example of Visual Basic. This module is called mdlRegistro. The functions used were:
n = EnumKey(HKEY_LOCAL_MACHINE, "Software\ODBC\ODBCINST.INI", vSubkey)
vSubkey is a variant and contains a list of n subkeys, and
sVersion(j) = QueryValue(HKEY_LOCAL_MACHINE, "Software\ODBC\ODBCINST.INI\" & vSubkey(j), "DriverODBCVer")
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|