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 the following table.
|
Item |
Use this function |
Comment |
|---|---|---|
|
Full context name |
GetName |
Value returned depends on the
|
|
Abbreviated context name |
GetShortName |
Value returned depends on the
|
|
Company name |
GetCompanyName |
Returns Appeon. |
|
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 2017.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:12this.GetContextService("ContextInformation", &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:123456789101112String ls_nameString ls_versionConstant String ls_currver = "12.5.0.1"icxinfo_base.GetShortName(ls_name)IF ls_name <> "PBRun" THENcb_close.visible = FALSEEND IFicxinfo_base.GetVersionName(ls_version)IF ls_version <> ls_currver THENMessageBox("Error", &"Must be at Version " + ls_currver)END IF