×

Discussion Board

Page 1 of 8 12345678 LastLast
Results 1 to 15 of 107
  1. #1
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    287

    long keypress When program is run background??

    sir
    i m using Symbian c++ for first time i have to develop an application which can run in background. the application is to send on sms when a long keypressed.
    Is this possible in Symbian c++?

    please help me
    thank you

  2. #2
    Registered User
    Join Date
    May 2007
    Location
    Poland
    Posts
    606

    Re: long keypress When program is run background??


  3. #3
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,347

    Re: long keypress When program is run background??

    Also you can check this article - Global Long Key Capture - Capture long presses

  4. #4
    Registered User
    Join Date
    Jun 2008
    Location
    India
    Posts
    1,048

    Re: long keypress When program is run background??

    Quote Originally Posted by arun09 View Post
    sir
    i m using Symbian c++ for first time i have to develop an application which can run in background. the application is to send on sms when a long keypressed.
    Is this possible in Symbian c++?

    please help me
    thank you
    Hi Arun,
    I am Sure it's possible.Try to use RWindowGroup API's function CaptureLongKey .

    Regards,
    Sumit

  5. #5
    Regular Contributor
    Join Date
    Aug 2006
    Location
    India
    Posts
    55

    Re: long keypress When program is run background??

    Hi arun
    This link will help you to get the solution for captureing the long key
    http://discussion.forum.nokia.com/fo...d.php?t=145116
    Try to create application using active objects.
    Regards,
    Hemraj.

  6. #6
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    287

    Re: long keypress When program is run background??

    Sir
    thank you for your replay. sir i m using Carbide c++ IDE i cannot create .sis file from .pkg file

  7. #7
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,347

    Re: long keypress When program is run background??

    i m using Carbide c++ IDE i cannot create .sis file from .pkg file
    What errors you are getting?

  8. #8
    Registered User
    Join Date
    Jun 2008
    Location
    India
    Posts
    1,048

    Re: long keypress When program is run background??

    Quote Originally Posted by arun09 View Post
    Sir
    thank you for your replay. sir i m using Carbide c++ IDE i cannot create .sis file from .pkg file
    R u getting any particular message for any particular line in your pkg.

  9. #9
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    287

    Re: long keypress When program is run background??

    the error message are:
    Error : Cannot find file : $(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\myproject.exe


    myproject_EKA2.pkg(23) : error: file I/O fault.

  10. #10
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,347

    Re: long keypress When program is run background??

    It seems the compilation process failed.

    You can check "Console" tab on Carbide.c++ IDE. All error messages may be found there.

  11. #11
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    287

    Re: long keypress When program is run background??

    hi,

    I am having the following error while i am trying to make sis file from pkg. Can you tell me the solution.

    I am getting the following error:

    Code:
    C:\Symbian\Carbide\workspace3\abc\sis>makesis abc_EKA2.pkg
    Processing abc_EKA2.pkg...
     Error : Cannot find file : $(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\abc.
    exe
    
    abc_EKA2.pkg(23) : error: file I/O fault.
    While I am checking Console I got this:

    Code:
    ***Building "abc_EKA2.pkg" for project "abc" and configuration "Emulator Debug (WINSCW) [S60_3rd_FP1_3]".
    No SIS Builder info found for pkg file.
    Total Time: 0 sec
    I am totally blocked here. Please tell me the solution.

    Thanks in advance.

  12. #12
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,347

    Re: long keypress When program is run background??


  13. #13
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    287

    Re: long keypress When program is run background??

    Hi,

    Thank you for your valid reply.

    Now I am blocked with a single error that regarding to the
    Code:
    CApaApplication* NewApplication()
    {
      return new KeyPress;
    }
    issue.

    My application name is keyPress. I am also giving my keyPress.mmp file below.


    Code:
    TARGET		  keyPress.exe
    TARGETTYPE	  exe
    UID			 0 0xEF037113
    
    USERINCLUDE	 ..\inc
    SYSTEMINCLUDE   \epoc32\include
    
    SOURCEPATH	  ..\src
    SOURCE		  keyPress.cpp
    
    LIBRARY		 euser.lib
    
    #ifdef ENABLE_ABIV2_MODE
      DEBUGGABLE_UDEBONLY
    #endif
    I am waiting for your reply.

    Regards,

    arun

  14. #14
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,347

    Re: long keypress When program is run background??

    Quote Originally Posted by arun09
    ***Building "abc_EKA2.pkg" for project "abc" and configuration "Emulator Debug (WINSCW) [S60_3rd_FP1_3]".
    No SIS Builder info found for pkg file.
    Total Time: 0 sec
    For "Emulator Debug (WINSCW)" configuration you don't need to make sis files.

    To build your project for real device you need to switch configuration and build project again:

    1) Right Click on project folder > Build Configurations > Set Active > Phone release...

    2) Right Click on project folder > Build Project

    Quote Originally Posted by arun09
    Now I am blocked with a single error that regarding to the
    Code:
    CApaApplication* NewApplication()
    {
    return new KeyPress;
    }
    issue.
    As I said try to check "Console" tab on Carbide.c++ IDE. And see console output from beginning.

  15. #15
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    287

    Re: long keypress When program is run background??

    Sir ,
    I am Arun. I have to submit my college project today. I need an application while we press a long keypress, the message(sms) has to be sent from my mobile. I have developed a code for this functio "long keypress".



    // Include Files
    #ifdef EKA2
    #include <eikstart.h>
    #endif


    #include "keyPress.h"
    #include <e32base.h>
    #include <e32std.h>
    #include <e32cons.h> // Console

    #include <apgwgnam.h> // CApaWindowGroupName


    // Constants
    // Text strings created by wizard
    _LIT( KTextConsoleTitle, "Console" );
    _LIT( KTextFailed, " failed, leave code = %d" );
    _LIT( KTextPressAnyKey, "\n[press any key to exit]\n" );

    // Key to listen to
    const TUint KKeyCode = EKeyLeftArrow;

    // Capture KNumberOfPressesToCapture key presses
    const TInt KNumberOfPressesToCapture = 3;

    // Global Variables
    // write all messages to this console
    LOCAL_D CConsoleBase* console;


    EXPORT_C CApaApplication* NewApplication()
    {
    return new CkeyPress;
    }




    ////////////////////////////////////
    // CGlobalCapturer
    ////////////////////////////////////

    // Constructor
    CGlobalCapturer::CGlobalCapturer() :
    CActive( EPriorityNormal )
    {
    // nothing
    }

    // Destructor
    CGlobalCapturer::~CGlobalCapturer()
    {
    delete iWindowGroupName;
    delete iWindowGroup;
    iWsSession.Close();
    }

    // Cancel listening to key presses
    void CGlobalCapturer:oCancel()
    {
    iWindowGroup->CancelCaptureLongKey( iCaptureHandle );
    iWindowGroup->CancelCaptureKey( iCaptureHandle );
    }

    void CGlobalCapturer::StartCapturingL()
    {
    // Connect to the window server
    User::LeaveIfError( iWsSession.Connect() );
    // Create an invisible window group. Well, we'll make it invisible later
    /** @todo Can ELeave be used with R-classes? */
    iWindowGroup = new (ELeave) RWindowGroup ( iWsSession );
    // @see RBlankWindow::Construct
    iWindowGroup->Construct( (TUint32)iWindowGroup, EFalse );

    // You cannot just call CaptureLongKey for the same key code
    // You MUST call CaptureKey first
    User::LeaveIfError( iCaptureHandle = iWindowGroup->CaptureKey( KKeyCode , 0, 0 ) );
    // And finally capture long key presses
    User::LeaveIfError( iLongCaptureHandle = iWindowGroup->CaptureLongKey( KKeyCode , KKeyCode, 0, 0, 0, 0 ) );
    // Send created window to the background and hide it from the
    // application switcher
    iWindowGroup->SetOrdinalPosition(-1);
    iWindowGroup->EnableReceiptOfFocus( EFalse );
    iWindowGroupName = CApaWindowGroupName::NewL( iWsSession );
    iWindowGroupName->SetHidden(ETrue);
    iWindowGroupName->SetWindowGroupName( *iWindowGroup );

    // Tell window server, that we are ready to receive events
    iWsSession.EventReady( &this->iStatus );
    CActiveScheduler::Add( this );
    SetActive();
    }

    // Key press happened
    void CGlobalCapturer::RunL()
    {
    if( iStatus == KErrNone )
    {
    // EEventKey received
    console->Write( _L( "Captured key press\n" ) );
    TWsEvent we;
    iWsSession.GetEvent( we );

    if( we.Key()->iCode == KKeyCode )
    {
    if( we.Key()->iRepeats == 0 )
    {
    console->Printf( _L( "Capture %i. Short key press\n" ), ++iCaptureCounter );
    }
    else
    {
    console->Printf( _L( "Capture %i. Long key press\n" ), ++iCaptureCounter );
    }
    }
    else
    {
    // This should never happen, but just to demonstrate how
    // it is possible to forward events to the default destination
    TInt foregroundAppId = iWsSession.GetFocusWindowGroup();
    iWsSession.SendEventToWindowGroup( foregroundAppId, we );
    } // if iCode
    if( iCaptureCounter == KNumberOfPressesToCapture )
    {
    // exit MainL() inner loop
    CActiveScheduler::Stop();
    }
    else
    {
    iWsSession.EventReady( &iStatus );
    SetActive();
    } // if captured enough times
    } // if iStatus
    else
    {
    // Framework notified of some error
    /** @todo Handle error if required */
    }
    }

    // Main function. Is TRAPD outside, in Start()
    LOCAL_C void DoStartL()
    {
    // Create active scheduler (to run active objects)
    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
    CleanupStack::PushL(scheduler);
    CActiveScheduler::Install(scheduler);

    // Call main function with command line
    // Command line is not really needed for this demo, but
    // why not to demonstrate this either?
    /* TBuf<256> cmdLine;
    RProcess().CommandLine( cmdLine );
    MainL( cmdLine );
    */
    // Delete active scheduler
    CleanupStack::PopAndDestroy(scheduler);
    }

    // Global Functions

    GLDEF_C TInt Start()
    {
    // Create cleanup stack
    __UHEAP_MARK;
    CTrapCleanup* cleanup = CTrapCleanup::New();

    // Create output console
    TRAPD(createError, console = Console::NewL(KTextConsoleTitle, TSize(KConsFullScreen,KConsFullScreen)));
    if (createError)
    return createError;

    // Run application code inside TRAP harness, wait keypress when terminated
    TRAPD(mainError, DoStartL());
    if (mainError)
    console->Printf(KTextFailed, mainError);
    console->Printf(KTextPressAnyKey);
    console->Getch();

    delete console;
    delete cleanup;
    __UHEAP_MARKEND;
    return KErrNone;
    }


    // Exported Functions

    #ifdef __WINS__
    EXPORT_C TInt WinsMain(TAny* /*aParam*/)
    {
    return Start();
    }
    #else
    GLDEF_C TInt E32Main()
    {
    return Start();
    }
    #endif

    #ifndef EKA2

    GLDEF_C TInt E32Dll(TDllReason )
    {
    return KErrNone;
    }

    #else

    GLDEF_C TInt E32Main()
    {
    return EikStart::RunApplication( NewApplication );
    }

    #endif

    // Local Functions
    LOCAL_C void MainL(const TDesC& /*aArgs*/)
    {
    console->Write( _L( "Starting key capturing\n" ) );
    // Create capturer
    CGlobalCapturer* capturer = new (ELeave) CGlobalCapturer();
    CleanupStack::PushL( capturer );
    // And start capturing
    capturer->StartCapturingL();

    // In a real application you should use CActiveSchedulerWait,
    // but in this small demo application we know that there is just
    // a single inner loop and no CActiveSchedulerWait "protection" is
    // needed
    CActiveScheduler::Start();
    // Cleanup. Demo completed
    CleanupStack::PopAndDestroy( capturer );
    }






    // End of file





    I am having an error on this programme. Please retify it an d help me in this critical situation. I have attached the error message below.

    Creation Time Description Resource Path Location Type
    1235440694593 *** missing separator. Stop.[\Symbian\9.2\S60_3rd_FP1_3\EPOC32\BUILD\Symbian\Carbide\workspace3\keyPress\group\KEYPRESS\GCCE\KEYPRESS.GCCE] keyPress line 94 C/C++ Problem

Similar Threads

  1. why program can not run in mobile phone ?
    By luohaibo in forum Symbian Tools & SDKs
    Replies: 9
    Last Post: 2009-03-05, 16:18
  2. Identify program running in background?
    By nire123 in forum Symbian
    Replies: 8
    Last Post: 2008-07-13, 07:50
  3. Can not run file manager program
    By agsapt in forum Symbian
    Replies: 0
    Last Post: 2002-08-27, 07:37
  4. i cannot run any java program in 9200 SDK
    By chili_fi in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2002-08-12, 23:34
  5. Run HandleSessionEventL() in background
    By chinazou305 in forum Symbian
    Replies: 0
    Last Post: 1970-01-01, 02:00

Posting Permissions

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