With the advent of Windows Vista we find a few new requirements. While Microsoft introduced new application standards years ago few of these were enforced until the release of Vista.
It has become more important than ever to do OS version sensing now. More importantly since Vista aggressively protects many of the file paths we used to put program data and settings into, we need to do some extra work to locate the acceptable locations for such files.
AppEx makes the necessary system calls in an easy to use form. This Class module has been designed to be "dropped into" your projects and offer an immediately accessible "extension" similar to the intrinsic global App object: there is no need to explicitly create an instance of AppEx in your programs.
The methods AppEx offers are:
AppEx.ComputerName()
AppEx.InitCommonControls()
AppEx.OSVersion()
AppEx.Path()
AppEx.PathAndSubDir()
AppEx.UserName()
InitCommonControls() is probably familiar enough to many of you. It should be called prior to loading VB forms in order to link to the Common Controls 6.0 library. It requires an application manifest with a Common Controls 6.0 <dependency> node in order to be effective.
The OSVersion() method accepts a parameter describing the type of information desired. AppEx provides an Enum AppExOSVersion defining these.
The Path() method accepts a parameter having CSIDL values for the different folders you might want. The set is not complete but contains the most useful ones as Enum AppExPaths.
PathAndSubDir() is similar to Path() but also accepts a SubDir parameter and a ForceCreation parameter. It is used to locate and optionally create a subfolder structure beneath one of the special folders.
The attached file contains a demo project based on this Class. While there is nothing particularly clever here, AppEx makes dealing with the issues quicker by providing pre-written code for the purpose.