Developer Note (6)-shared software registration program compiling instance (3)

Source: Internet
Author: User
Microsoft introduced the Registry concept in Windows NT3.51. Registry is an important part of Windows. It stores various configuration parameters in Windows. Each functional module of Windows and the installed application module must read the registry information at startup and set their own runtime environment based on these parameters, we can write the registration information into the registry to achieve shared registration of the program.
In VB, there are two ways to access the Registry: The first is to use the functions provided by VB:
Private Sub commandementclick ()
Dim KeyName as String 'Project name created
Subitem under Dim SubKeyName as String'
Value item name under Dim ValueName as String'
Dim Value1 as string' value
Keyname = "MyKey"
SubKeyName = "MySubKey"
ValueName = "MyValueName"
Value1 = "My New Key !"
'Check whether the MyValueName value item exists. If it does not exist, return NOEXIT
Ret = GetSetting (KeyName, SubKeyName, ValueName, "NOEXIT ")
If ret = "NOEXIT" then
'If the MyValueName value does not exist, this value is created.
SaveSetting KeyName, SubKeyName, ValueName, value1
Else
'If the program exists, the MyKey is deleted.
DeleteSetting (KeyName)
End if
End Sub
The default location is HKEY_CURRENT_USERSoftwareVB and VBA Program Settings.
Second, use Windows API functions to process the registry
Global Const HKEY_CLASSES_ROOT = & H80000000
Global Const HKEY_CURRENT_USER = & H80000001
Global Const HKEY_LOCAL_MACHINE = & H80000002
Global Const HKEY_USERS = & H80000003
Global Const ERROR_SUCCESS = 0 &
Global Const ERROR_NO_MORE_ITEMS = 259 &

Public Const REG_SZ = 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.