Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 173
  • Last Modified:

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?
0
njam_njam
Asked:
njam_njam
1 Solution
 
Ryan ChongCommented:
Grab some useful examples at:
http://www.vbcode.com/asp/code.asp?lstCategory=Registry

cheers
0
 
njam_njamAuthor Commented:
Thanks, man! I'll try it as soon I'll get back home.
0
 
cocomobasicCommented:
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
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
marconovaroCommented:

Here is a nice class:

http://www.vbaccelerator.com/home/VB/Code/Libraries/Registry_and_Ini_Files/Complete_Registry_Control/article.asp

that will do the "dirty" job for you. You'll have a nicer and easier "object oriented" interface.
HTH
M
0
 
yoann_proutCommented:
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\FortuneTeller\", 1, "REG_BINARY"
    WshSReg.RegWrite "HKCU\Software\ACME\FortuneTeller\MindReader", "Goocher!", "REG_SZ"
   
    MsgBox WshSReg.RegRead("HKCU\Software\ACME\FortuneTeller\MindReader")
   
    WshSReg.RegDelete "HKCU\Software\ACME\FortuneTeller\MindReader"
    WshSReg.RegDelete "HKCU\Software\ACME\FortuneTeller\"
    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
0
 
snowbordingexeCommented:
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.

0
 
njam_njamAuthor Commented:
Thank you !
0
 
CleanupPingCommented:
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?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now