Venkat wrote:
> Instead of Calculator application it is launching the  "HotSync" 
>   application everytime.
> The below procedure i followed inorder to launch the Calculator 
>   application .
> 
>   EventType Event;
>   Event.eType = keyDownEvent;
>   Event.data.keyDown.chr = vchrCalc;
>   Event.data.keyDown.modifiers = commandKeyMask;
>   EvtAddEventToQueue (&Event);
> 
> If there any PDA Preferance settings to be changed to launch the 
>   Calc application?
> If there is any other method to follow please let me know .

What about searching for the database with the type 'appl' and
creator 'calc' and launching that?  Something like this...

        DmSearchStateType searchstate;
        UInt16 cardnum;
        LocalID localid;

        if (DmGetNextDatabaseByTypeCreator (
                true, & searchstate, 'appl', 'calc',
                true, & cardnum, & localid) == errNone)
        {
            if (SysUIAppSwitch (cardnum, localid,
                    sysAppLaunchCmdNormalLaunch, NULL) == errNone)
            {
                return;   // or whatever else is necessary to
                          // process the next event so you can
                          // receive/process the appStopEvent
            }
        }

        // if we get here, we were unable to launch calculator

There are a few potential flaws with this approach:
(1) It will always launch the default calculator.  If a user has
    some other calculator installed, it won't get launched,
    unlike using the calculator virtual key code, which would
    launch a third-party calculator replacement.
(2) I'm not 100% sure I should be passing NULL as the command
    parameter block (last argument to SysUIAppSwitch()),
    although it seems OK because what parameters do you need
    for a normal launch?
(3) The single call to DmGetNextDatabaseByTypeCreator() might
    be considered a little reckless since it doesn't look
    through all the matching databases (although you can only
    get multiple databases on OS 3.0 and older, according to
    the documentation).  But, how many databases are there
    going to be with type 'appl' and creator 'calc'?  Hopefully
    exactly one database.  (I know, famous last words.)

Hope that helps.

  - Logan

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

Reply via email to