Hi!
This must have been the most difficult thing I�ve ever done. I can�t get 
anything to happen.

For example I can�t use the compiler.

I have the following saved as a file called hello.cpp:

#include <Pilot.h>
#include "HelloRsc.h"           // resource definitions (created by Constructor)



// === prototypes ===

static Boolean StartApplication(void);
static void StopApplication(void);                                              // 
clean up before app exit
static Boolean ApplicationHandleEvent(EventPtr event);  // handle form load 
events
static void EventLoop(voidg);                                                   // the 
event loop
static Boolean MainFormHandleEvent(EventPtr event);             // handle events for 
the main form


//========================================================================
// StartApplication() initializes anything the program needs at startup,
// and switches the the applications main form.
//
// It returns an error code if there's an error, or false (0) if there is
// no error.
//
static Boolean StartApplication(void)
{
        FrmGotoForm(MainForm);                                  // start the first 
form.
        return false;
}



//========================================================================
// StopApplication() saves any shut-down information and closes all the
// forms.
//
//
static void StopApplication(void)
{
        FrmCloseAllForms();
}



//========================================================================
// MainFormHandleEvent() processes events when the main form is active.
//
// Returns true if the event was handled, false if it was not.
//
//
static Boolean MainFormHandleEvent(EventPtr event)
{
        Boolean         handled = false;
        FormPtr         frm;
        char *          pStr;


        switch (event->eType) {
        case ctlSelectEvent:                      // control button was pressed and 
released.

                if (event->data.ctlEnter.controlID == MainHelloAgainButton) {

                                // write "hello again" to the current form

                        pStr = "Hello, Again!";
                        WinDrawChars(pStr, StrLen(pStr), ((160-FntCharsWidth(pStr, 
StrLen(pStr)))/2), 80);
                        handled = true;
                }
                break;


        case frmOpenEvent:                              // opening the form - 
initialize it
                frm = FrmGetActiveForm();               // get a pointer to the form 
for identification
                FrmDrawForm(frm);                               // draw the form
                handled = true;
                break;

        case menuEvent:                                 // a menu item was selected

                        // Since there's only one menu item (the "about" screen), do 
it.

                MenuEraseStatus(0);                             // first clear the 
menu from the display


                frm = FrmInitForm(AboutForm);   // load the About form
                FrmDoDialog(frm);                               // display it and wait 
for the "ok" button
                FrmDeleteForm(frm);                             // and delete the form 
(going back to MainForm)
                handled = true;
                break;
        }
        return(handled);
}



//========================================================================
// ApplicationHandleEvent() watches for frmLoadEvent events; it then sets
// the appropriate event handler for the form.  (we only have one form
// event handler)
//
// Returns true if the event was handled, false if it was not.
//
//
static Boolean ApplicationHandleEvent(EventPtr event)
{
        FormPtr frm;
        Int             formId;
        Boolean handled = false;

        if (event->eType == frmLoadEvent) {

                        // Load the form resource specified in the event,
                        // then activate the form.

                formId = event->data.frmLoad.formID;    // get the form ID number
                frm = FrmInitForm(formId);                              // load it, 
getting the form's pointer
                FrmSetActiveForm(frm);                                  // now OS 
sends events to this form

                        // Set the event handler for the form.  The handler of the
                        // currently active form is called by FrmDispatchEvent each
                        // time it receives an event.

                switch (formId) {
                case MainForm:
                        FrmSetEventHandler(frm, MainFormHandleEvent);
                        break;
                }
                handled = true;
        }
        return handled;
}



//========================================================================
// EventLoop() simply gets the next event and hands it to each event
// handler in line until one of them does something with it.
// Stays in the loop until a stop event.
//
//
static void EventLoop(void)
{
        EventType       event;
        Word                    error;

        do
                {
                EvtGetEvent(&event, evtWaitForever);                    // get next 
event
                if (! SysHandleEvent(&event))                                   // do 
system events
                        if (! MenuHandleEvent(0, &event, &error))       // do 
menu-handling events
                                if (! ApplicationHandleEvent(&event))   // watch for 
change of form
                                        FrmDispatchEvent(&event);                      
 // events for current form
                }
        while (event.eType != appStopEvent);
}


//========================================================================
// PilotMain() is called by Palm OS to start an application
//
// arguments:
//      cmd                             = launch code; how/why the application was 
started
//      cmdPBP                  = parameter block for the command
//      launchFlags             = additional flags
//
// Returns 0 or an error code
//
//
DWord PilotMain(Word cmd, Ptr cmdPBP, Word launchFlags)
{

                // check for a normal launch; we won't do anything for any
                // other launch code

        if (cmd == sysAppLaunchCmdNormalLaunch) {
                if (!StartApplication()) {                              // setup and 
initialization
                        EventLoop();                                            // do 
the event loop
                        StopApplication();                                      // do 
any clean-up before exiting
                }
        }

        return 0;
}

I got the file in a directory called test.
if I would like to compile this, how do I do?
Can I use the command prompt (I have windows-2000) or do I have to use 
cygwin B20?
I tried to write this: m68k-palmos-gcc hello.cpp
I got the message: Installation problem cannot exec 'cpp': No such file or 
directory.

Please help me if you can, I would be very grateful

Maria

_________________________________________________________________
H�mta MSN Explorer kostnadsfritt p� http://explorer.msn.se


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to