×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    77

    stop an application from inside another application

    Hi! Is it possible to stop an application from inside another application? If it's possible, how can i achieve it? I know that we can start an application that way. if anybody knows it, please reply to me.
    Thanks a lot!

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    371

    RE: stop an application from inside another application

    Hi,

    Check out classes TApaTask and TApaTaskList from SDK Help. Using TApaTaskList you are able to get access to any applications in the system and with TApaTask you call EndTask() or KillTask() to stop an application.

    Best Regards,
    Marko / Forum Nokia

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    22

    How can i command an app from another app?

    Thank you for this useful information.
    I need also another information:
    i have two application, A and B.
    A starts B.
    Now i want to send some controls through the OK and EXIT key from the application A to the application B.
    How can i do that??
    Thanks a lot!!

  4. #4
    Registered User
    Join Date
    Mar 2003
    Location
    Czech rep.
    Posts
    24
    Hi

    just call

    TApaTask::SendKey(TInt aKeyCode,TInt aModifiers);

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    22
    Thank you,mseeman!!!
    can you also tell me the meaning of iCode and iModifiers?
    i didn't understand them from the SDK's documentation.
    Do you also know what i have to write in iCode and iModifiers to have the pressing of the left softkey(the option button generally)?

    Thank you for you patience!!

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    22
    Sorry!!
    i was wrong!!
    instead of iModifiers and iCode i intend aKeyCode and aModifiers.

  7. #7
    Registered User
    Join Date
    Mar 2003
    Location
    Czech rep.
    Posts
    24
    Hi

    SDK says that "aKeyCode" is character code. So I think 'a' for key "a" or constants from E32keys.h for other keys, like

    EStdKeyUpArrow

    And "modifiers" will be state of shifts, Ctrls etc as defined in TEventModifier in the same header file.

    But now I'm not sure about it, let me know whether I'm right

  8. #8
    Registered User
    Join Date
    Mar 2003
    Posts
    22
    Thank you for your helpfull information.
    But i can't find in struct TKeyCode the corrispondent of SoftKeyOK (the OPTION button).
    Do you know which is?
    probably EKeyEnter or EKeyYes...
    and then Do have I to set aModifiers to '0'?
    Thank you,you'll be my hero!!!

  9. #9
    Registered User
    Join Date
    Mar 2003
    Location
    Czech rep.
    Posts
    24
    Hmm, don't know what's code of the navi keys (I think communicators use F1 - F4 for the display associated buttons) but I'm sure the joystick push (fire) is EKeyDevice3. So these 2 navikeys might be EKeyDevice1 and EKeyDevice2.

    Otherwise implement function HandleKeyEventL in you AppUI class:

    if (aType == EEventKeyDown)
    {
    TBuf<9> a;
    a.Num(aKeyEvent.iCode);
    CEikonEnv::Static()->InfoWinL(a,_L(""));
    }

    Then every pressed key makes dialog showing the keycode.

  10. #10
    Registered User
    Join Date
    Mar 2003
    Location
    Czech rep.
    Posts
    24
    Yes, forgot to the modifier. Ofcourse the enumeration makes bit flags 0001, 0010, 0100, 1000 etc. If you want none of them, use 0

  11. #11
    Registered User
    Join Date
    Mar 2003
    Posts
    22

    Thanks MSEEMAN

    Hi,i tried the SendKey command but it doesn't seem to work,
    here there is the code:
    //before of this app A (this application) starts B (the app whose i
    //don't have the source code but only the .sis)

    RWsSession wSession;
    wSession.Connect();
    TApaTaskList tasklist(wSession);
    TApaTask appA(CCoeEnv::Static()->WsSession());
    appA.SetWgId(CCoeEnv::Static()->RootWin().Identifier());

    //now with the following command i bring A in
    //foreground,because the start of B causes B to go in foreground

    appA.BringToForeground();

    //now with the following command i find the app B

    TApaTask appB = tasklist.FindByPos(1);

    //now i send to B the left softkeyOK (the OPTION button)
    //that,thanks to your program,i find out correspond to 164

    appB.SendKey(164,0);

    //now i bring app B in foreground

    appB.BringToForeground

    //i should see the option menu of app B opened, but it isn't
    //so. app B goes in foreground but it doesn't seem to receive
    //nothing

    Try to find out why i can't send a command,please!!!
    THANK YOU!

  12. #12
    Registered User
    Join Date
    Mar 2003
    Location
    Czech rep.
    Posts
    24
    Sorry to be late, I must have forgotten to set reply notification.

    Unfortunately I don't know, my wits are at the end. I can advise you just to try something easier like sending letter characters. Or let the app in the front, perhaps it can't receive characters if it's not focused. Anyway let me know how you are going with the prob.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •