PocketBuilder provides several functions you can use to manage application settings in the Windows CE registry.
For complete information about these functions, see the online Help.
To explore and edit the Windows CE registry on a Pocket PC, you can download the PHM Registry Editor.
The examples that follow use the registry to keep track of database connection parameters. The connection parameters are maintained in the registry in the MyCo\MyApp\database branch under HKEY_CURRENT_USER\Software.
The following script retrieves values for the default Transaction object from the registry.
RegistryGet("HKEY_CURRENT_USER\Software\MyCo\MyApp\database", & "dbms", sqlca.DBMS) RegistryGet("HKEY_CURRENT_USER\Software\MyCo\MyApp\database", & "database", sqlca.database) RegistryGet("HKEY_CURRENT_USER\Software\MyCo\MyApp\database", & "userid", sqlca.userid) RegistryGet("HKEY_CURRENT_USER\Software\MyCo\MyApp\database", & "dbpass", sqlca.dbpass) RegistryGet("HKEY_CURRENT_USER\Software\MyCo\MyApp\database", & "logid", sqlca.logid) RegistryGet("HKEY_CURRENT_USER\Software\MyCo\MyApp\database", & "logpass", sqlca.logpass) RegistryGet("HKEY_CURRENT_USER\Software\MyCo\MyApp\database", & “servername", sqlca.servername) RegistryGet("HKEY_CURRENT_USER\Software\MyCo\MyApp\database", & "dbparm", sqlca.dbparm)
The following script stores the values for the Transaction object (set elsewhere in the application) in the registry:
RegistrySet("HKEY_CURRENT_USER\Software\MyCo\MyApp\database", & "dbms", sqlca.DBMS) RegistrySet("HKEY_CURRENT_USER\Software\MyCo\MyApp\database", & "database", sqlca.database) RegistrySet("HKEY_CURRENT_USER\Software\MyCo\MyApp\database", & "userid", sqlca.userid) RegistrySet("HKEY_CURRENT_USER\Software\MyCo\MyApp\database", & "dbpass", sqlca.dbpass) RegistrySet("HKEY_CURRENT_USER\Software\MyCo\MyApp\database", & "logid", sqlca.logid) RegistrySet("HKEY_CURRENT_USER\Software\MyCo\MyApp\database", & "logpass", sqlca.logpass) RegistrySet("HKEY_CURRENT_USER\Software\MyCo\MyApp\database", & "servername", sqlca.servername) RegistrySet("HKEY_CURRENT_USER\Software\MyCo\MyApp\database", & "dbparm", sqlca.dbparm)
Copyright © 2004. Sybase Inc. All rights reserved. |
![]() |