VDF-GUIdance logo



  Visual DataFlex Logo
  

Shared knowledge leads to accumulated knowledge

        Printer Friendly Page


Global access to windows registry database

by Allan Greis Eriksen

Summary

This package contains global procedure and global functions to gain access to the windows registry database
Size: 2 KB Download
Date Created: 14/07/2004
Date Updated: 14/07/2004
Author: Allan Greis Eriksen
Company: NordTeam Gruppen ApS


This package contains global methods to easily access the windows registry.
These global methods consist of three functions and one procedure.
The methods are in fact wrapper functions to a subclass of the cRegistry class which does provide the functionality.

Functions:
ReadGlobalReg Global Handle hRoot String sRegkey String sValue String sStandard Returns String
WriteGlobalReg  Global Handle hRoot String sRegkey String sValue String sTxt
DoesGlobalKeyExists Global Handle hRoot String sRegKey Returns Boolean

Procedure:
DeleteGlobalReg Global Handle hRoot String sRegKey String sValue

For hRoot you can use any of the following root keys:
HKEY_CLASSES_ROOT 
HKEY_CURRENT_USER 
HKEY_LOCAL_MACHINE 
HKEY_USERS
HKEY_PERFORMANCE_DATA
HKEY_CURRENT_CONFIG  
HKEY_DYN_DATA

Example



The following example will list all of the VDF versions installed on this machine.
Since the code requires VDF8 or higher we are starting to count from that version to make our lives a little bit easier.


Define CS_DAWVDF For  "SOFTWARE\Data Access Worldwide\Visual DataFlex\"
Define CS_VDFVER For  "CurrentVersion"

Use GlobalReg.pkg //

Procedure ShowInstalledVDFVersions
  String sVersion
  Integer iLoop
  Integer iMajor
  Integer iMinor
  Integer iStart
  
  Showln " :: This program has found the following versions of Visual DataFlex installed "
  Showln " :: on this system:"

  Move 80 To iLoop  // We're starting from VDF8 to simplify the example
  
  While (iLoop<200) // Stop at VDF19.9
    Move (mod(iLoop,10)) To iMinor
    Move (iLoop/10) To iMajor
    Get ReadGlobalReg HKEY_LOCAL_MACHINE (CS_DAWVDF+"\"+string(iMajor)+"."+string(iMinor)) CS_VDFVER "" To sVersion
    If (sVersion<>"") Begin
      Showln sVersion
    End
    Increment iLoop
  Loop
End_Procedure // ShowInstalledVDFVersions

This example will only show installed versions of VDF because the default value is returned to sVersion if the registry value is not found. The default value that we pass is "" (an empty string).

Download



Globalreg.zip ~ 2Kb