njam_njam
asked on
Visual Basic programming
Is there any way how to write settings in registry, but in other places, not in the " vb and vba programms" group?
ASKER
Thanks, man! I'll try it as soon I'll get back home.
yes you can, but u need to know Win32 APIs;
try researching on the APIs:
RegCreateKeyEx
RegOpenKeyEx
RegSetValueEx
RegQueryValueEx
RegDeleteKey
RegCloseKey
with these functions, you could create you own registry keys, delete them, query a value, and set a value at your desired location..
the only problem is it takes time to learn them since there are STRUCTURES involved and there are lots of things to watch out for.... but i know you can do it
also, try this site
http://ltpb.8m.com/tutorial/Registry.html
try researching on the APIs:
RegCreateKeyEx
RegOpenKeyEx
RegSetValueEx
RegQueryValueEx
RegDeleteKey
RegCloseKey
with these functions, you could create you own registry keys, delete them, query a value, and set a value at your desired location..
the only problem is it takes time to learn them since there are STRUCTURES involved and there are lots of things to watch out for.... but i know you can do it
also, try this site
http://ltpb.8m.com/tutorial/Registry.html
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To your visual basic project add as reference the OCX wshom.ocx, then for example you can try this :
__________________________ __________ __________ __________ __
Option Explicit
Private Sub Command1_Click()
Dim WshSReg As New WshShell
WshSReg.RegWrite "HKCU\Software\ACME\Fortun eTeller\", 1, "REG_BINARY"
WshSReg.RegWrite "HKCU\Software\ACME\Fortun eTeller\Mi ndReader", "Goocher!", "REG_SZ"
MsgBox WshSReg.RegRead("HKCU\Soft ware\ACME\ FortuneTel ler\MindRe ader")
WshSReg.RegDelete "HKCU\Software\ACME\Fortun eTeller\Mi ndReader"
WshSReg.RegDelete "HKCU\Software\ACME\Fortun eTeller\"
WshSReg.RegDelete "HKCU\Software\ACME\"
End Sub
__________________________ __________ __________ __________ __
For more infos, just take a look here :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsMthRegWrite.asp
__________________________
Option Explicit
Private Sub Command1_Click()
Dim WshSReg As New WshShell
WshSReg.RegWrite "HKCU\Software\ACME\Fortun
WshSReg.RegWrite "HKCU\Software\ACME\Fortun
MsgBox WshSReg.RegRead("HKCU\Soft
WshSReg.RegDelete "HKCU\Software\ACME\Fortun
WshSReg.RegDelete "HKCU\Software\ACME\Fortun
WshSReg.RegDelete "HKCU\Software\ACME\"
End Sub
__________________________
For more infos, just take a look here :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsMthRegWrite.asp
Ooops if you don't have the file go there http://msdn.microsoft.com/downloads/default.asp?URL=/downloads/sample.asp?url=/msdn-files/027/001/733/msdncompositedoc.xml
Try this
SaveSetting(ProgramName as string, FolderName as string, Keyname as string, Value as string)
To read
GetSetting(ProgramName as string, Foldername as string, Keyname as string)
Example
Private sub cmdSaveReg_Click()
dim a
a = inputbox("Enter a string")
savesetting "Test Program", "Settings", "String" _
, a
end sub
Private sub cmdReadReg_Click()
dim a as string
a = getsetting("Test Program", "Settings", "String")
msgbox a
end sub
This should solve your problem
These functions are all part of visual basic 6.0
Hope this Works.
Aaron.
SaveSetting(ProgramName as string, FolderName as string, Keyname as string, Value as string)
To read
GetSetting(ProgramName as string, Foldername as string, Keyname as string)
Example
Private sub cmdSaveReg_Click()
dim a
a = inputbox("Enter a string")
savesetting "Test Program", "Settings", "String" _
, a
end sub
Private sub cmdReadReg_Click()
dim a as string
a = getsetting("Test Program", "Settings", "String")
msgbox a
end sub
This should solve your problem
These functions are all part of visual basic 6.0
Hope this Works.
Aaron.
ASKER
Thank you !
njam_njam:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
Experts: Post your closing recommendations! Who deserves points here?
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
Experts: Post your closing recommendations! Who deserves points here?
http://www.vbcode.com/asp/code.asp?lstCategory=Registry
cheers