Line-by-line Anatomy of Hello.c
#include <PalmOS.h>
PalmOS.h
is an include file that contains most of the standard Palm OS include files.
It is from the Palm SDK and contains the needed reference materials for us to use the Palm API and its defined constants.
UInt32 PilotMain(UInt16 cmd, void *cmdPBP, UInt16 launchFlags) {
The function PilotMain( ) is equivalent to the main( )
procedure of C.
It returns errNone
if the application processed the launch code successfully, or an appropriate error code if there was a problem.
The arguments are somewhat similar to C's
- argc:
It contains the number of parameters added to the command line.
- argv:
If
argc
is greater than 0, then the contents of the argument variables (argv[1]
, argv[2]
, etc.) are evaluated.
They specify which event fired the application.
- UInt32:
An integer value is stored in 4 bytes.
- PilotMain:
The entry point for all Palm OS applications, this function's sole purpose is to receive and respond to launch codes.
- UInt16:
An integer value is stored in 2 bytes.
- cmd:
The Launch Code to which your application is to respond.
- cmdPBP:
It is a pointer to a structure containing any launch-command-specific parameters, or
NULL
if the launch code has none.
See the description of each launch code for a description of the parameter structure that accompanies it, if any.
- LaunchFlags:
When an application is launched with any launch command, it also is passed a set of Launch Flags that indicate
- whether your application's global variables are available,
- whether your application is now the active application,
- whether it already was the active application, and so on.