Argh! Sending a keyDown event with the launchChr, instead of an appStop event, does the trick:
UInt32 PilotMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) {
Err err = errNone;
EventType event;
switch (cmd) {
case sysAppLaunchCmdNormalLaunch:
LaunchNetPrefsPanel();
break;
case sysAppLaunchCmdReturnFromPanel:
MemSet(&event, sizeof(event), 0);
event.eType = keyDownEvent;
event.data.keyDown.chr = launchChr;
event.data.keyDown.modifiers = commandKeyMask;
EvtAddEventToQueue (&event);
do {
EvtGetEvent(&event, evtWaitForever);
SysHandleEvent(&event);
} while (event.eType != appStopEvent);
break;
default:
break;
}
return(err);
}
Since a programmer who wished his program to do exactly the same thing on a sysAppLaunchCmdReturnFromPanel as a sysAppLaunchCmdNormal need only add a single line to his code:
UInt32 PilotMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) {
switch (cmd) {
case sysAppLounchCmdReturnFromPanel:
case sysAppLaunchCmdNormalLaunch:
.
.
.
in my not-so-humble-opinion the resend of sysAppLaunchCmdNormal is a mis-feature of Palm OS.
