|
-
December 5th, 2000, 06:26 AM
#1
trouble with registry
i wanna get data from registry, so i write this:
strRegData = GetSetting(HKEY_CURRENT_CONFIG \ Display, Settings, BitsPerPixel)
...and get division by zero. where is bug?
thanks, ToXa.
-
December 5th, 2000, 08:23 AM
#2
Re: trouble with registry
Try
strRegData = GetSetting(HKEY_CURRENT_CONFIG +"\ Display", Settings, BitsPerPixel)
-
December 5th, 2000, 08:35 AM
#3
i try another...[inside]
i try this:
strRegData = GetSetting("HKEY_CURRENT_CONFIG\Display", "Settings", "Resolution", "zero")
...its work without error message, but write in strRegData a "zero", BUT IN MY REGISTRY THE RESOLUTION VALUE PRESENT!
where is bug?
-
December 5th, 2000, 09:40 AM
#4
Re: i try another...[inside]
The "root" branch for GetSetting() function is the following:
HKEY_CURRENT_USER\Software\VB and VBA Program Settings\
That means that you cannot access branches above this. In order to do that, you have to use API functions (open registry, retrieve registry value and then close registry). There are controls and dlls that do this in an "automatic" way, similar to GetSetting. I believe if you search a little bit, you'll find some code (i think there was a control called easyreg...)
Nick A.
-------------------------
Nick A.
-
December 5th, 2000, 10:07 AM
#5
not working...[inside]
ok, i wanna to get data from:
HKEY_CURRENT_USER\Software\VB and VBA Program Settings\Time Thingy\Setup
Interval - it's value is 5
so i type:
strRegData=GetSeting("HKEY_CURRENT_USER\Software\VB and VBA Program Settings\Time Thingy", "Setup", "Interval", "Zero")
..and get "Zero" - may be it something wrong with my PC?
-
December 5th, 2000, 10:17 AM
#6
Some Registry Samples
http://www.planet-source-code.com/xq...s/ShowCode.htm
http://www.planet-source-code.com/xq...s/ShowCode.htm
http://www.planet-source-code.com/xq...s/ShowCode.htm
http://www.planet-source-code.com/xq...s/ShowCode.htm
http://www.netfokus.dk/vbadmincode/c...ctregistry.zip
http://vbaccelerator.com/codelib/inireg/registry.htm
Or alternatively if you don't need all the enumeration functions and know the specific keys you need to read/write you can use the WSH (Windows Scripting Host) in this way:
private Sub Command1_Click()
Dim wshShell as Object
set wshShell = CreateObject("WScript.Shell")
With wshShell
MsgBox .RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName")
End With
End Sub
Or if you add a reference to Windows Script Host Model to the project you can declare wshShell As IWshShell and you can access the properties in the usual way.
TimCottee
I know a little about a lot of things and a lot about very little.
Brainbench MVP For Visual Basic
http://www.brainbench.com
MCP, MCSD, MCDBA, CPIM
-
December 5th, 2000, 10:20 AM
#7
Re: not working...[inside]
You don't need to specify the full path of the key when using GetSetting:
strRegData=GetSeting("HKEY_CURRENT_USER\Software\VB and VBA Program Settings\Time Thingy", "Setup", "Interval", "Zero")
Should be specified as
strRegData=GetSetting("Time Thingy", "Setup", "Interval", 0)
As the default value is an integer should be specified as an integer.
TimCottee
I know a little about a lot of things and a lot about very little.
Brainbench MVP For Visual Basic
http://www.brainbench.com
MCP, MCSD, MCDBA, CPIM
-
December 5th, 2000, 10:21 AM
#8
Re: not working...[inside]
Sorry that should read:
Dim intRegData As Integer
intRegData=GetSeting("Time Thingy", "Setup", "Interval", 0)
Instead of strRegData.
TimCottee
I know a little about a lot of things and a lot about very little.
Brainbench MVP For Visual Basic
http://www.brainbench.com
MCP, MCSD, MCDBA, CPIM
-
December 5th, 2000, 11:01 AM
#9
great thanx - IT WORKING!!!
))
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
|