What is AppInfo.opx?
AppInfo.opx is an OPL extension library that lets you retrieve information about all the installed applications on your Symbian devices. Features include retrieving the application caption, icons and flags, getting information about files and mime types and retrieving memory information. It is also possible to reboot your device using APPINFO.OPX.
AppInfo.opx is available for the entire Nokia Communicator range (9210, 9210i, 9300, 9500).
Download AppInfo.opx
You can download AppInfo.opx from the Downloads page.
Usage
To use APPINFO.OPX, use the following statement at the beginning of your OPL application:
INCLUDE "APPINFO.OXH"
Installing APPINFO.OPX
To install AppInfo.opx, double click on the AppInfoOPX.SIS-file in Windows Explorer or copy it to your device and open it from the FileManager application. After this, copy the AppInfo.oxh file to the \SYSTEM\OPL folder on either drive C: or drive D:
Bugs or improvements
If you find any bugs or have further ideas for improvement, please let me know by sending an email to Arjen Broeze or by posting a message in the OPX and OPM support forum.
Documentation of APPINFO.OPX functions
aiConnect:
AppInfo gets its information from the Application Architecture Server. aiConnect: establishes a connection with this server and should always be called before calling any other function in AppInfo.opx.
aiDisconnect:
Disconnect the connection with the Application Architecture server established with aiConnect:.
aiGetAppList:
After a call to aiConnect:, aiGetAppList: is used to get the complete list of all applications installed on the device. This list is maintained internally and cannot be accessed directly. A call to this function is followed by subsequent and repeated calls to aiNextApp: to retrieve all applications in the list.
aiAppCount%:
This function returns the number of installed applications. This function can be useful if you want to show a progress bar when collecting the application information for example.
aiNextApp%:
Retrieves information about the next application from the list of applications. This information is stored in the OPX and can be retrieved with the commands in the following section. If there is a next application, aiNextApp%: will return KTrue%, otherwise it will return KFalse%. The following example walks gets the list of applications and prints the caption of every application:
PROC ShowAllCaptions:
aiConnect:
aiGetAppList:
WHILE aiNextApp%:
PRINT aiAppCaption$:
ENDWH
aiDisconnect:
ENDP
aiAppCaption$:
Returns the caption of the current application.
aiAppUid&:
Returns the UID (Symbian Unique ID) of the current application.
aiAppFullName$:
Returns the filename on disk of the current application.
The following three functions take a UID as parameter. Therefore they can also be called when there is no current application, as long as a valid UID is specified and a connection to the Application Architecture server has been established with aiConnect:.
aiAppEmbeddability%(aUid&):
Returns whether or not the application specified by the aUid& parameter can be embedded in another application. Possible return values are:
KAppNotEmbeddable% | application cannot be embedded | |
KAppEmbeddable% | application can be embedded | |
KAppEmbeddableOnly% | application can only be used as embedded application |
aiAppIsHidden%(aUid&):
Returns whether or not the application specified by the aUid& parameter is hidden. An application that is hidden is not shown in the Desktop.
aiAppSupportsNewFile%(aUid&):
Returns whether or not the application specified by the aUid& parameter supports the creation of new files.
aiGetAppIconInformation%:(aUid&)
Gets information about the application icons for the application specified by the aUid& parameter. Returns KTrue% if successful, KFalse% otherwise (for example if the application with the specified UID cannot be found). The information is stored internally in the OPX and can be retrieved with the following 5 functions.
Note: this function can only be used after establishing a connection to the Application Architecture Server with aiConnect:
aiGetAppIconCount%:
Returns the number of icons available for the application.
aiGetAppIconWidth%:(aIndex%)
Returns the width of the icon with index aIndex%. This value must be between 0 and aiGetAppIconCount%:-1.
aiGetAppIconHeight%:(aIndex%)
Returns the height of the icon with index aIndex%. This value must be between 0 and aiGetAppIconCount%:-1.
aiGetAppIconBySize:(aWidth%,aHeight%,aBitmapId%,aLeft%,aTop%,aType%)
Retrieves and paints the icon with the dimensions specified by the aWidth% and aHeight% parameters. If an icon of this size does not exist, an icon will be created which is a scaled version of an existing icon that has a size which is nearest to the requested size.
The icon will be painted on the bitmap passed in the aBitmapId% parameter starting at the position specified by the aLeft% and aTop% parameters. The bitmap passed to aiGetAppIconBySize: must be a valid bitmap created with the gCREATEBIT function, otherwise an error will be raised. How the icon will be drawn depends on the value of the aType% parameter:
KIconTypeIcon% | draws the icon | |
KIconTypeMask% | draws the mask | |
KIconTypeIconAndMask% | draws the icon and mask combined |
aiGetAppIconByIndex:(aIndex%,aBitmapId%,aLeft%,aTop%,aType%)
Retrieves and paints the icon with index aIndex%. This value must be between 0 and aiGetAppIconCount%:-1.
The icon will be painted on the bitmap passed in the aBitmapId% parameter starting at the position specified by the aLeft% and aTop% parameters. The bitmap passed to aiGetAppIconByIndex: must be a valid bitmap created with the gCREATEBIT function, otherwise an error will be raised. How the icon will be drawn depends on the value of the aType% parameter:
KIconTypeIcon% | draws the icon | |
KIconTypeMask% | draws the mask | |
KIconTypeIconAndMask% | draws the icon and mask combined |
aiGetMimeTypeName$:(aFileName$)
Retrieves the mime type of a file and returns the string representation of this mime type. For example, calling aiGetMimeTypeName$:("C:\TEXT.TXT") on an existing text file with that name would return "text/plain".
aiGetMimeTypeUid&:(aFileName$)
Retrieves the mime type of a file and returns the UID of this mime type. For example, calling aiGetMimeTypeName$:("C:\TEXT.TXT") on an existing text file with that name would return the mime type UID for plain text files.
aiAppUidForMimeType&:(aMimeName$,aMimeUid&)
Retrieves the UID of the application that is associated with the mime type specified in aMimeName$ or aMimeUid&.
aiAppUidForDocument&:(aFileName$)
Retrieves the UID of the application that is associated with the document specified in the aFileName$ parameter. Calling this function is identical to calling aiAppUidForMimeType&:(aiGetMimeTypeName$:(aFileName),0) or aiAppUidForMimeType&:("",aiGetMimeTypeUid&:(aFileName$))
aiFileIsProgram%:(aFileName$)
Returns KTrue% if the file specified in the aFileName$ parameter contains executable code, KFalse% otherwise.
aiGetThreadRamSizes:(aThreadId&,BYREF aHeapSize&,BYREEF aStackSize&)
Retrieves memory information about the thread specified in aThreadId&. The heap size and stack size is reported in bytes and is returned in the aHeapSize& and aStackSize& variables.
aiGetFreeRam&:
Returns the amount of available RAM (in bytes).
aiCompressHeaps&:
Compresses the heaps (reducing the amount of used memory and increasing the amount of available memory). Returns the amount of memory (in bytes) that is freed as a result of this action.
aiRebootMachine:
Reboots the device.
Note: open applications are not closed and all unsaved data in these applications will be lost.
aiThreadExists%:(aThreadId&)
Checks if the thread specified in aThreadId& still exists. Returns KTrue% if it does, KFalse% otherwise.