Context information service
You use the context information service to obtain information
about an application’s execution context. The service provides
current version information, as well as whether the application
is running in the PowerBuilder execution environment.
Accessing context information
Using the context information service, you can access the
information in Table 21-4.
|
Item |
Use this function |
Comment |
|---|---|---|
|
Full context name |
GetName |
Value returned depends on the context:
|
|
Abbreviated context name |
GetShortName |
Value returned depends on the context:
|
|
Company name |
GetCompanyName |
Returns Sybase, Inc. |
|
Version |
GetVersionName |
Returns the full version number (for example, |
|
Major version |
GetMajorVersion |
Returns the major version number (for example, |
|
Minor version |
GetMinorVersion |
Returns the minor version number (for example, |
|
Fix version |
GetFixesVersion |
Returns the fix version number (for example, |
Using the ClassName function for context information
You can also use the ClassName function
to determine the context of the object.
You can use this information to verify that the context supports
the current version. For example, if your application requires features
or fixes from Version 15.0.1, you can use the context information
service to check the version in the current execution context.
To access context information:
-
Declare an instance or global variable
of type ContextInformation:1ContextInformation icxinfo_base -
Create the context information service by calling
the GetContextService function:1this.GetContextService("ContextInformation", &1   icxinfo_base) -
Call context information service functions as
necessary.This example calls the GetShortName function
to determine the current context and the GetVersionName function
to determine the current version:1String ls_name1String ls_version1Constant String ls_currver = "15.0.1"1icxinfo_base.GetShortName(ls_name)1IF ls_name <> "PBRun" THEN1cb_close.visible = FALSE1END IF1icxinfo_base.GetVersionName(ls_version)1IF ls_version <> ls_currver THEN1MessageBox("Error", &1"Must be at Version " + ls_currver)1END IF