Click here to Skip to main content
15,914,905 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Change of BackGround Color Pin
Rickard Andersson2018-Dec-01 1:53
Rickard Andersson2018-Dec-01 1:53 
GeneralCLSID from interface Pin
Ryszard Krakowiak18-Dec-01 1:01
Ryszard Krakowiak18-Dec-01 1:01 
GeneralRe: CLSID from interface Pin
Ryszard Krakowiak18-Dec-01 1:42
Ryszard Krakowiak18-Dec-01 1:42 
GeneralRe: CLSID from interface Pin
Tim Smith18-Dec-01 2:01
Tim Smith18-Dec-01 2:01 
GeneralPalm OS newcomer... Pin
Braulio Dez17-Dec-01 23:06
Braulio Dez17-Dec-01 23:06 
GeneralRe: Palm OS newcomer... Pin
Nish Nishant17-Dec-01 23:46
sitebuilderNish Nishant17-Dec-01 23:46 
GeneralRe: Palm OS newcomer... Pin
Braulio Dez18-Dec-01 0:27
Braulio Dez18-Dec-01 0:27 
GeneralRe: Palm OS newcomer... Pin
Nish Nishant18-Dec-01 0:33
sitebuilderNish Nishant18-Dec-01 0:33 
Here are some snippets from a talk I once gave on Palm OS coding :-

If you gimme your email address I'll send you the entire presentation.... the snippets below represent only about 33% of the presentation.

The PilotMain Function

The PilotMain() acts as the entry point for the application. It is analogous to main() in DOS programs or WinMain() in Windows applications. PilotMain() can check for launch codes which are passed as arguments. It is responsible for starting two important functions, StartApplication() and EventLoop().

The StartApplication() Function

This function is responsible for initializing the required data structures. It also initializes the program’s initial user interface by activating the initial form. Then it calls the EventLoop() function

The EventLoop() Function

The EventLoop function processes events going though these steps:

• EvtGetEvent retrieves the next available event from the
system event queue and passes it to a succession of event
handlers for processing.

• Each handler can choose (by returning a non-zero value) to handle an event, so that it’s not seen or processed by subsequent event handlers.

The EventLoop function processes all the events that flow through the application as it executes. EventLoop returns when an event is encountered that directs the application to quit. When control returns to PilotMain from EventLoop, the application quits, returning an error code of zero.

The SysHandleEvent Function
EventLoop gives the SysHandleEvent function the first opportunity to process each event. This function processes low-level events, like low-battery conditions, application launch, power keys, and Graffiti ® writing recognition.

Writing your first program
1. Create your form using Constructor for Palm OS
2. Add a button to your form
3. Save the resource file
4. Write the C program
5. Create the project using Code Warrior
6. Add the C program and the resource
7. Build it
8. Test it on the emulator

The Code
#include <pilot.h>
#include "MemoPadRsc.h"
static void StartApplication(void);
static Boolean MainFormHandleEvent(EventPtr event);
static void EventLoop(void);

static void StartApplication(void)
{
FormPtr frm;
frm = FrmInitForm(MemoPadMainForm);
FrmSetActiveForm(frm);
FrmDrawForm(frm);
}

static Boolean MainFormHandleEvent(EventPtr event)
{
Boolean handled = false;
EventType newEvent;

if (event->eType == ctlSelectEvent)
{
MemSet(&newEvent, sizeof(EventType), 0);
newEvent.eType = appStopEvent;
EvtAddEventToQueue(&newEvent);
handled = true;
}
return(handled);
}

static void EventLoop(void)
{
EventType event;
do
{
EvtGetEvent(&event, evtWaitForever);
if (! SysHandleEvent (&event))
if (! MainFormHandleEvent(&event))
FrmHandleEvent(FrmGetActiveForm(), &event);
}
while (event.eType != appStopEvent);
}

DWord PilotMain(Word cmd, Ptr cmdPBP, Word launchFlags)
{
if (cmd == sysAppLaunchCmdNormalLaunch)
{
StartApplication();
EventLoop();
}
return(0);
}


Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
GeneralRe: Palm OS newcomer... Pin
Braulio Dez18-Dec-01 0:40
Braulio Dez18-Dec-01 0:40 
GeneralRe: Palm OS newcomer... Pin
Braulio Dez18-Dec-01 2:49
Braulio Dez18-Dec-01 2:49 
GeneralRe: Palm OS newcomer... Pin
Nish Nishant18-Dec-01 16:05
sitebuilderNish Nishant18-Dec-01 16:05 
GeneralRe: Palm OS newcomer... Pin
markkuk17-Dec-01 23:48
markkuk17-Dec-01 23:48 
GeneralRe: Palm OS newcomer... Pin
Braulio Dez18-Dec-01 0:27
Braulio Dez18-Dec-01 0:27 
Generalodbc drivers under XP Pin
17-Dec-01 22:17
suss17-Dec-01 22:17 
GeneralRe: odbc drivers under XP Pin
Michael P Butler18-Dec-01 3:33
Michael P Butler18-Dec-01 3:33 
Generalsql query question Pin
17-Dec-01 21:23
suss17-Dec-01 21:23 
GeneralRe: sql query question Pin
markkuk17-Dec-01 22:20
markkuk17-Dec-01 22:20 
GeneralRe: sql query question Pin
18-Dec-01 0:16
suss18-Dec-01 0:16 
GeneralI guess this is impossible! Pin
Rickard Andersson2017-Dec-01 21:07
Rickard Andersson2017-Dec-01 21:07 
GeneralRe: I guess this is impossible! Pin
Joaquín M López Muñoz17-Dec-01 21:30
Joaquín M López Muñoz17-Dec-01 21:30 
GeneralRe: I guess this is impossible! Pin
Braulio Dez17-Dec-01 23:08
Braulio Dez17-Dec-01 23:08 
GeneralRe: I guess this is impossible! Pin
Nish Nishant17-Dec-01 23:44
sitebuilderNish Nishant17-Dec-01 23:44 
GeneralRe: I guess this is impossible! Pin
Braulio Dez18-Dec-01 0:02
Braulio Dez18-Dec-01 0:02 
GeneralRe: I guess this is impossible! Pin
Nish Nishant18-Dec-01 0:05
sitebuilderNish Nishant18-Dec-01 0:05 
GeneralRe: I guess this is impossible! Pin
Joaquín M López Muñoz18-Dec-01 0:19
Joaquín M López Muñoz18-Dec-01 0:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.