ComMÉDIA
for Windows CE HomeSource CodeRegistry ActiveX Controls



References


Windows CE
Web Community



[Prev] [Random] [Next]
[List Sites] [Next 5]

VBCE Registry Test.zip   (8.5k)

The "Registry_Manipulation.bas" module included on this example include the following public functions:

Public Function GetAllRegistrySettings( _
ByVal root As Long, _
Byval KeyPath As String)
Public Function GetRegistrySetting( _
ByVal root As Long, _
ByVal KeyPath As String, _
ByVal ValueName As String, _
ByRef keyV_Type As Long)
Public Sub SaveRegistrySetting( _
ByVal root As Long, _
ByVal KeyPath As String, _
ByVal ValueName As String, _
ByVal keyV_Type As Long, _
ByVal NewData As String)
Public Sub DeleteRegistrySetting( _
ByVal root As Long, _
ByVal KeyPath As String, _
ByVal SubKey As String)
Public Sub DeleteRegistryKey( _
ByVal root As Long, _
ByVal KeyPath As String, _
ByVal KeyName As String)

NOTE: These functions can manipulate any Registry Setting and should be used VERY CAREFULLY.

The "root" values have been defined as constants:

' Reg Key ROOT Types
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003

as long as the "keyV_Type" values:

' Reg Data Types...
Const REG_NONE = 0
Const REG_SZ = 1
Const REG_EXPAND_SZ = 2
Const REG_BINARY = 3
Const REG_DWORD_LITTLE_ENDIAN = 4
Const REG_DWORD_BIG_ENDIAN = 5
Const REG_MULTI_SZ = 7 

This module also include "clones" of the regular Visual Basic registry settings functions, including:

Public Function GetSetting( _
  ByVal appname As String, _
  ByVal section As String, _
  ByVal key As String, _
  ByVal default As String)
Public Sub SaveSetting( _
  ByVal appname As String, _
  ByVal section As String, _
  ByVal key As String, _
  ByVal setting As String)
Public Function DeleteSetting( _
  ByVal appname As String, _
  ByVal section As String, _
  ByVal key As String)
Public Function GetAllSettings( _
  ByVal appname As String, _
  ByVal section As String)

which will protect the registry from unrecoverable damage.

There are, however, some differences between these functions and the regular counterparts:

There are no optional parameters. VBCE does not permit that functionality.

The settings are always read or written from:

HKEY_CURRENT_USER\Software\< Company >

where "Company" is taken from the project property "Company Name" or the value "ceVB Program Settings "is assumed. This makes it easier to leave settings for all your programs under the name of your company.

There are defaults for most of the calling parameters when passing an empty string for them:

  • appname => is taken from the project property "Product Name". If this is also empty, the value "ceProgam" is assumed.
  • section => the value "Default" is assumed.
  • key => the value "Default" is assumed.

The test program performs the following actions:

"Program Settings" and "Enumerate" use the VB functions counterparts - try to "Write" and "Read" some settings. Then "Enumerate" them. When you're finished clean the registry by "Erase"ing each setting.
With "Read Registry" you can "Read" any setting - try it with the values left in the boxes. This a special "Multi-String" setting.
On "Write Registry" you can only write on a specific location - the 3 first boxes are disabled (this is just to protect your registry...) "Multi-String is not supported but there's commented code on the Form.

Enjoy,
ComMEDIA, Lda.



[ Home ] [ Source Code ] [ Articles ] [ Download ] [ Support ]
[ VBCE Icons Tool ] [ ActiveX Controls ]

Copyright ComMedia 2000-2003. All rights reserved.
Microsoft, Windows CE, and Visual Basic are registered trademarks of Microsoft Corporation.

Windows CE ActiveX Controls specifically designed in ATL for eVB.

Date Time
Month Calendar
Progress Bar
Popup Menu
Tray Icon
Locale
Settings
RAS Dial
RAS Entries
RAS PPTP

>> Try them! <<


Icons Tool

The Evaluation version of the
VBCE Icons Tool
performs exactly as the registered version but draws all Icons over a grid with scrambled colors .

Check the details.

VBCE UDT's

"...to extend the intrinsic VB functionality with extra functions provided by the MS Windows Operating System..."

more...