Well, I have noticed some very interesting behavior that does not seem to 
be documented anywhere (well at least places I have been looking in).

when calling the SysAppLaunch api call the last parameter is a pointer to 
UInt32 which would be the return value of the PalmMain function of the 
callee.  Now the interesting behavior comes in when one is trying to pass 
back a UInt32 value (which btw Err is defined as).

Here is a breaf description of what I have noticed, I was trying to return 
a constant 0x8002 back and I was expecting the returned value to be set to 
0x00008002 since the returned value is UInt32, however my expectations were 
absolutely wrong, instead I was getting back 0xFFFF8002

However when lets say Err is passed back that is set to 0 the returned 
value is actually 0x00000000 which would seem to be somewhat inconsistent 
behavior.

Anyway, it is possible that I am doing something wrong, so let me paste 
some code from different sections and hopefully somebody from Palm (or not) 
would be able to shed some light on why things are the way they are.

When calling the App:
{       // the last test to find out if the app is multientry enabled
        UInt32 iSysAppLaunch = errNone;
        Err eError = SysAppLaunch
        (
                kiMemoryCardID,
                glAppID[giAppCount],
                NULL,
                0x8002,
                NULL,
                &iSysAppLaunch
        );

        if (!eError)
        // this fails because iSysAppLaunch for some reason 
        // is set to 0xFFFF8002         
        if (iSysAppLaunch == 0x8002) 
        {
                // this never gets executed
                // since the test always fails
        }
}


in order to get around the failed check comparing to 0x8002
I did this
        // this is a get around the 0xFFFF8002
        if ((*(((UInt16*)(&iSysAppLaunch))+1)) == 0x8002)  


here is a code snippet of the app being called
UInt32 PilotMain( UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
{
        switch (cmd)
        {
                case kiAppLaunchCmdMultiEntryEnabled:
                        return ((UInt32)cmd);
                        
                default:
                        break;

        }
        
        return errNone;
}


Anyway, if anyone has any light to share please email it to my email 
address as well [EMAIL PROTECTED]

-- 
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