|
-
September 26th, 2008, 09:25 AM
#1
registry read and write
Hi guys,
is their any api present to read and write to registry in VB, kindly provide me some sample
-
September 26th, 2008, 08:06 PM
#2
Re: registry read and write
 Originally Posted by resumurof
Hi guys,
is their any api present to read and write to registry in VB, kindly provide me some sample
VB6 makes this simple to do, just use
SaveSetting
and
GetSetting
Note: All values are stored as strings
Example:
If you wanted to save a window's current width on unload so it could be used the next time the window was opened, you could save it's current width to the registry using the below code.
Code:
Dim sWidth as String
sWidth = CStr(oForm.width)
SaveSetting "MyAppName", "MyWindow", "Width", sWidth
Where oForm is the form being closed
Then to retrieve the value:
Code:
Dim sDefaultValue as String
'sDefaultValue is used if registry value is not found
sDefaultValue = "600"
iWindowWidth = CInt(GetSetting("MyAppName", "MyWindow", "Width", sDefaultValue)
oForm.Width = iWindowWidth
-
September 26th, 2008, 09:06 PM
#3
Re: registry read and write
Keep in mind that the getsetting and save setting functions write to the current user section of the registry under software.
This is the easiest way to write to the registry but there is also API calls that can be used which will allow you to write to other areas in the registry when needed.
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
|