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.
Printable View
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.
Try
strRegData = GetSetting(HKEY_CURRENT_CONFIG +"\ Display", Settings, BitsPerPixel)
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?
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.
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?
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.
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.
Sorry that should read:
Dim intRegData As Integer
intRegData=GetSeting("Time Thingy", "Setup", "Interval", 0)
Instead of strRegData.
:)))