×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    20

    Red face RunL() is hit forcibly when OPTIONS softkey is pressed

    Hi,

    I have to run and exe from an application and also need to get notified when the exe exits normally or otherwise. In order to monitor the process termination i have used RProcess::Logon(); RProcess::Resume; then SetActive(), so that the monitoring happens in an asynchronous manner in an AO. I dont have any problems uptill now.

    Now, I also need to stop the process(launched exe) in the midway by pressing stop option within OPTIONS. So I have used a Message queue to pass strings to the process. I am also able to stop the process in the midway.

    Now, the problem....after i have started the exe from my app, obvoiusly it starts running. But while exe runs and i hit the OPTIONS soft key, My options pop up(which is ofcourse ok) and the RunL() of the active object which i use to handle process termination is hit (this should not happen, that too with iStatus.Int() value being KErrNone) although the process still runs,showing that the process is alive. Hence, after RunL() is hit and no farther process termination notification is possible.

    Why the outstanding RProcess::Logon() request is forcibly completed ??(while the exe is still runs) with iStatus being KErrNone and execution hits RunL() when i hit the OPTIONS softkey? any idea? This is a Little but very tricky problem.

    Here are the codes:

    In the Calling Application:

    void CProcessMonitor::MonitorL()//For launching the exe and monitoring it
    {
    TBuf<100> commandline;
    TBuf<100> KFileName;

    commandline.Copy(iCGetRunFileAppPropertyWatch->GetPropertyHandle());
    TInt len=ExeNameArray->MdcaCount();

    if((len!=0)&&(Index<len))
    {
    KFileName.Copy(ExeNameArray->MdcaPoint(Index));


    TInt err1=iMonitor.Create(KFileName, commandline,EOwnerProcess);


    if(err1 != KErrNone)
    {
    CAknErrorNote* iMyErrorNote;
    iMyErrorNote= new (ELeave) CAknErrorNote;
    iMyErrorNote->ExecuteLD(_L("Failed to Create Process"));
    iMonitor.Close();
    User::Leave(err1);

    }

    iMonitor.Logon(iStatus);
    iMonitor.Resume();
    Index++;
    SetActive();

    }
    else
    Index=0;
    }

    void CProcessMonitor::RunL()
    {
    if(iStatus.Int()==KErrNone)
    {
    if(iMonitor.ExitType()==EExitPanic)
    {
    //****This piece of code for panic description************

    CAknErrorNote* iMyErrorNote;
    iMyErrorNote= new (ELeave) CAknErrorNote;
    TBuf<40> msg(_L("Process Panicked:"));
    msg.Append(iMonitor.ExitCategory());
    msg.Append(_L("-"));
    msg.AppendNum(iMonitor.ExitReason());
    iMyErrorNote->ExecuteLD(msg);


    }
    else
    {
    //****This piece of code for normal process termination****
    //Note: This section is hit in this problem, it shows output as an error note "Process exit status: 30 in handset"
    CAknErrorNote* iMyErrorNote;
    iMyErrorNote= new (ELeave) CAknErrorNote;
    TBuf<50> error(_L("Process exit status:"));
    error.AppendNum(iMonitor.ExitType());//process is active:value 3 in output
    error.AppendNum(iStatus.Int());//value 0 ??
    iMyErrorNote->ExecuteLD(error);
    if(ExecuteNext)//set the variable ExecuteNext=ETrue if next process is to be executed
    //set this variable to EFalse if the current process needs to be stopped by loader
    MonitorL();//Starts the next Process
    }
    }

    iMonitor.Close();

    }


    and

    Here is the HandleCommandL():

    void CGetRunFileAppAppUi::HandleCommandL(TInt aCommand)
    {
    switch ( aCommand )
    {
    case EAknSoftkeyBack:
    case EEikCmdExit:
    {
    Exit();
    break;
    }
    case EGetRunFileAppCmdGet:
    {
    // Nothing
    break;
    }
    case EGetRunFileAppCmdRun:
    {
    // iEikonEnv->InfoMsg(_L("test"));
    iAppContainer->StartRunProcessL(); //calls the CProcessMonitor::MonitorL()
    break;
    }
    case EGetRunFileAppCmdStop:
    {
    //to be added later
    // iEikonEnv->InfoMsg(_L("test"));
    ControlQueue.Send(_L8("STOP"));
    break;
    }
    // TODO: Add Your command handling code here

    default:
    break;
    }
    }


    I dont find the codes of called exe related to this problem as the called exe runs and terminates as required, the problem is there in calling application that launches it.

    Can Anyone help this peculiar problem of mine???

    Thanks a lot for being patient and reading so much, i hope i have communicated the problem properly.

    Please do help.

    Thanks,
    Arunangshu

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    2

    Re: RunL() is hit forcibly when OPTIONS softkey is pressed

    Set iStatus to KRequestPending if the active object's RunL is not supposed to be called yet.

    When active scheduler gets an event, it will go through all active objects looking for one with status Active (set with SetActive()) and whose iStatus is different from KRequestPending. It will call the first one that fulfills these conditions.

Similar Threads

  1. Midlet freezes until Options key is pressed
    By spm24 in forum Mobile Java Tools & SDKs
    Replies: 3
    Last Post: 2009-06-10, 05:44
  2. Nokia 6600:Joystick pressed in Canvas invokes options menu, how to disable ?
    By kakoskin in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2004-03-10, 16:10

Posting Permissions

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