A basic Hello, world! application
How It Works
This is the canonical "Hello, world!" program. It is not the
smallest possible Palm OS program, because that would take out all
the infrastructure you'll need if you want to turn this into a real
program. Still, it is quite a bit smaller than many other Hello world!
programs I've seen.
The basic flow of control goes like this: You tap on the program's
icon and the OS finds and calls your program's PilotMain() function
with the "normal launch" launch code. (There are other launch codes, but
they're way beyond the scope of a Hello, world! program.) The program
responds by loading the main form and starting the event loop. All the
action from this point on takes place in the event loop, or in functions
that it calls. This program's event loop is typical many programs
can use it just as I've shown it here, without any changes.
The first event handled by the main event loop is
frmLoadEvent, which is sent as a result of the
FrmGotoForm() call in the program's StartApplication()
function. The program responds by setting up the form; the most important
initialization is setting up the form's event handler, because all events
that aren't handed by the system or by the main application loop go to
that event handler. In this simple program, the form's event handler
is pretty dull, but in a real program, it will have many more events
to handle, mainly events sent when interesting things happen to the
form's controls.
The Code
This program requires PRC-Tools 2.0 and SDK 3.5 to build.
hello.zip 2.5 KB
|