Actually, it's worse than that. Bulent is telling the target application that it
was launched normally (by specifying sysAppLaunchCmdNormalLaunch), and then not
doing a "normal" launch. In essence, the launcher was lying to to the launchee.
The launchee was expecting global variables to be set up, but the launcher
didn't do anything to set them up (it didn't specify sysAppLaunchFlagNewGlobals
in the launch flags).
I think that article <http://oasis.palm.com/dev/kb/manuals/1713.cfm> covers what
Bulent really wants to be doing here.
-- Keith Rollin
-- Palm OS Emulator engineer
"Schettino, John" <[EMAIL PROTECTED]> on 07/09/2000 12:48:03 PM
Please respond to "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent by: "Schettino, John" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
cc: (Keith Rollin/US/PALM)
Subject: RE: global variables?
I don't believe you free the cmdPBP block... that's done by the OS
(since
the system owns the memory...)
- John Schettino
Palm OS Programming for Dummies: http://schettino.tripod.com
-----Original Message-----
From: Bulent Gecer
To: Palm Developer Forum
Sent: 7/8/00 4:52 AM
Subject: SV: global variables?
I've checked page 58 in the Companion, but it doesn't answer my
question about globals. On the other hand, on page 57 it says
"Global variables are generally only allocated after an application
receives
sysAppLaunchCmdNormalLaunch".
I'm using the following code in the app that does the launching:
cmdPBP = MemPtrNew(sizeof(UInt32));
if (!cmdPBP)
return memErrNotEnoughSpace;
MemPtrSetOwner(cmdPBP, 0);
*(UInt32 *) cmdPBP = creatorID;
err = SysAppLaunch(0, "MyApp", 0, sysAppLaunchCmdNormalLaunch,
cmdPBP,
NULL);
which according to the Companion shouldn't be a problem for the launched
app to use globals, since it gets launched by
sysAppLaunchCmdNormalLaunch,
unless it is the cmdPBP parameter that causes the problem since I'm
passing
info
(the creator ID of the launching app) through it.
In the app that gets launched I've put the following code:
static DWord PilotMain(Word cmd, Ptr cmdPBP, Word launchFlags)
{
Err error;
UInt32 parentCreatorID;
error = RomVersionCompatible (ourMinVersion, launchFlags);
if (error) return (error);
switch (cmd)
{
case sysAppLaunchCmdNormalLaunch:
// Test the cmdPBP parameter. If it's NULL, then the Palm app
launcher
// launched us. Otherwise, it points to the creator ID of the
app
that
// launched us.
if (cmdPBP)
{
parentCreatorID = *(UInt32 *) cmdPBP;
MemPtrFree(cmdPBP); // don't leak that memory
/*Do something...*/
}
error = AppStart();
if (error)
return error;
FrmGotoForm(MainForm);
AppEventLoop();
AppStop();
break;
default:
break;
}
return 0;
}
What is the problem?
Regards,
/Bulent Gecer
Steve Mann <[EMAIL PROTECTED]> skrev i
diskussionsgruppsmeddelandet:[EMAIL PROTECTED]
>
> >When "MyApp" gets launched by another application with the call
> >SysAppLaunch(...), I get the following message in POSE:
>
> Check page 58 of the Palm OS Programmer's Companion.
>
> Regards,
> Steve Mann
> --
> -------------------------------------------
> Creative Digital Publishing Inc.
> 1315 Palm Street, San Luis Obispo, CA 93401-3117
> -------------------------------------------
> 805.784.9461 805.784.9462 (fax)
> [EMAIL PROTECTED] http://www.cdpubs.com
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/