×

Discussion Board

Page 2 of 8 FirstFirst 12345678 LastLast
Results 16 to 30 of 107
  1. #16
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    287

    Re: long keypress When program is run background??

    sir

    i checked this article - Global Long Key Capture - Capture long presses

    attcah .zip folder download. .sis file its not working m N80 phone .this .sis file are working which model

  2. #17
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: long keypress When program is run background??

    As you can see attached example application is designed to S60 2nd ed., so it can't be installed on S60 3rd ed. device.

  3. #18
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    287

    Re: long keypress When program is run background??

    sir


    please cheack this

    Code:
    // 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::DoCancel()
    {
    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

  4. #19
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    287

    Re: long keypress When program is run background??

    sir
    please cheack it


    Code:
    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::DoCancel()
    {
    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

  5. #20
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: long keypress When program is run background??

    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
    Might be you want to check that your build system is correct, particularly the perl Version.

  6. #21
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    95

    Re: long keypress When program is run background??

    HI,


    FOR CAPTURING A LONG KEY PRESS U NEED TO CAPTURE THAT KEY FIRST AND THEN CAPTURE IT FOR LONG PRESSES.

    1.)// first capture the key

    iWindowGroup->CaptureKey( ); //iWindowGroup : OBJECT OF RWindowGroup class

    2.)
    // And finally capture long key presses
    iWindowGroup->CaptureLongKey( ); //iWindowGroup :OBJECT OF RWindowGroup class

  7. #22
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    287

    Re: long keypress When program is run background??

    Quote Originally Posted by A.A.M. View Post
    As you can see attached example application is designed to S60 2nd ed., so it can't be installed on S60 3rd ed. device.
    the application are installed my N72 but not working

  8. #23
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    287

    Re: long keypress When program is run background??

    I have compile the long keypress program the following errors occured

    please help to rectify it.

    Errors caused tool to abort.
    make[1]: *** [\Symbian\9.2\S60_3rd_FP1_3\EPOC32\RELEASE\WINSCW\UDEB\presskey.exe] Error 1
    make: *** [TARGETPRESSKEY] Error 2
    make -j 4 -s -r -f "\Symbian\9.2\S60_3rd_FP1_3\EPOC32\BUILD\Symbian\Carbide\workspace3\presskey\group\PRESSKEY\WINSCW\PRESSKEY.WINSCW" UDEB
    mwldsym2.exe: Undefined symbol: 'RWsSession::RWsSession(void) (??0RWsSession@@QAE@XZ)'
    mwldsym2.exe: referenced from 'void MainL(void) (?MainL@@YAXXZ)' in presskey.cpp:45
    mwldsym2.exe: Undefined symbol: 'int RWsSession::Connect(void) (?Connect@RWsSession@@QAEHXZ)'
    mwldsym2.exe: referenced from 'void MainL(void) (?MainL@@YAXXZ)' in presskey.cpp:47
    mwldsym2.exe: Undefined symbol: 'RWindowGroup::RWindowGroup(class RWsSession &) (??0RWindowGroup@@QAE@AAVRWsSession@@@Z)'
    mwldsym2.exe: referenced from 'void MainL(void) (?MainL@@YAXXZ)' in presskey.cpp:54
    mwldsym2.exe: Undefined symbol: 'int RWindowGroup::Construct(unsigned long, int) (?Construct@RWindowGroup@@QAEHKH@Z)'
    mwldsym2.exe: referenced from 'void MainL(void) (?MainL@@YAXXZ)' in presskey.cpp:55
    mwldsym2.exe: Undefined symbol: 'long RWindowGroup::CaptureKeyUpAndDowns(unsigned int, unsigned int, unsigned int) (?CaptureKeyUpAndDowns@RWindowGroup@@QAEJIII@Z)'
    mwldsym2.exe: referenced from 'void MainL(void) (?MainL@@YAXXZ)' in presskey.cpp:60
    mwldsym2.exe: Undefined symbol: 'void RWsSession::EventReady(class TRequestStatus *) (?EventReady@RWsSession@@QAEXPAVTRequestStatus@@@Z)'
    mwldsym2.exe: referenced from 'void MainL(void) (?MainL@@YAXXZ)' in presskey.cpp:63
    mwldsym2.exe: referenced from 'void MainL(void) (?MainL@@YAXXZ)' in presskey.cpp:104
    mwldsym2.exe: Undefined symbol: 'void RWindowTreeNode::SetOrdinalPosition(int) (?SetOrdinalPosition@RWindowTreeNode@@QAEXH@Z)'
    mwldsym2.exe: referenced from 'void MainL(void) (?MainL@@YAXXZ)' in presskey.cpp:67
    mwldsym2.exe: Undefined symbol: 'void RWindowGroup::EnableReceiptOfFocus(int) (?EnableReceiptOfFocus@RWindowGroup@@QAEXH@Z)'
    mwldsym2.exe: referenced from 'void MainL(void) (?MainL@@YAXXZ)' in presskey.cpp:68
    mwldsym2.exe: Undefined symbol: 'class CApaWindowGroupName * CApaWindowGroupName::NewLC(class RWsSession const &) (?NewLC@CApaWindowGroupName@@SAPAV1@ABVRWsSession@@@Z)'
    mwldsym2.exe: referenced from 'void MainL(void) (?MainL@@YAXXZ)' in presskey.cpp:69
    mwldsym2.exe: Undefined symbol: 'void CApaWindowGroupName::SetHidden(int) (?SetHidden@CApaWindowGroupName@@QAEXH@Z)'
    mwldsym2.exe: referenced from 'void MainL(void) (?MainL@@YAXXZ)' in presskey.cpp:70
    mwldsym2.exe: Undefined symbol: 'int CApaWindowGroupName::SetWindowGroupName(class RWindowGroup &) const (?SetWindowGroupName@CApaWindowGroupName@@QBEHAAVRWindowGroup@@@Z)'
    mwldsym2.exe: referenced from 'void MainL(void) (?MainL@@YAXXZ)' in presskey.cpp:71
    mwldsym2.exe: Undefined symbol: 'void RWsSession::GetEvent(class TWsEvent &) (?GetEvent@RWsSession@@QAEXAAVTWsEvent@@@Z)'
    mwldsym2.exe: referenced from 'void MainL(void) (?MainL@@YAXXZ)' in presskey.cpp:79
    mwldsym2.exe: Undefined symbol: 'int RWsSession::GetFocusWindowGroup(void) (?GetFocusWindowGroup@RWsSession@@QAEHXZ)'
    mwldsym2.exe: referenced from 'void MainL(void) (?MainL@@YAXXZ)' in presskey.cpp:101
    mwldsym2.exe: Undefined symbol: 'int RWsSession::SendEventToWindowGroup(int, class TWsEvent const &) (?SendEventToWindowGroup@RWsSession@@QAEHHABVTWsEvent@@@Z)'
    mwldsym2.exe: referenced from 'void MainL(void) (?MainL@@YAXXZ)' in presskey.cpp:102
    mwldsym2.exe: Undefined symbol: 'void RWsSession::EventReadyCancel(void) (?EventReadyCancel@RWsSession@@QAEXXZ)'
    mwldsym2.exe: referenced from 'void MainL(void) (?MainL@@YAXXZ)' in presskey.cpp:111
    mwldsym2.exe: Undefined symbol: 'void RWindowTreeNode::Close(void) (?Close@RWindowTreeNode@@QAEXXZ)'
    mwldsym2.exe: referenced from 'void CleanupClose<class RWindowGroup>::Close(void *) (?Close@?$CleanupClose@VRWindowGroup@@@@CAXPAX@Z)' in e32base.inl:3140
    mwldsym2.exe: Undefined symbol: 'void RWsSession::Close(void) (?Close@RWsSession@@QAEXXZ)'
    mwldsym2.exe: referenced from 'void CleanupClose<class RWsSession>::Close(void *) (?Close@?$CleanupClose@VRWsSession@@@@CAXPAX@Z)' in e32base.inl:3140

    Total Time: 2 sec

    ***Invoking abld command
    perl.exe -S ABLD.PL \Symbian\Carbide\workspace3\presskey\group\ final winscw udeb
    make -r -f "\Symbian\9.2\S60_3rd_FP1_3\EPOC32\BUILD\Symbian\Carbide\workspace3\presskey\group\WINSCW.make" FINAL CFG=UDEB VERBOSE=-s

    Total Time: 2 sec

    ***Invoking abld command
    perl.exe -S ABLD.PL \Symbian\Carbide\workspace3\presskey\group\ test export
    make -r -f "\Symbian\9.2\S60_3rd_FP1_3\EPOC32\BUILD\Symbian\Carbide\workspace3\presskey\group\EXPORTtest.make" EXPORT VERBOSE=-s
    Nothing to do

    Total Time: 2 sec

    ***Errors were detected in build. See the Problems or Console view for details.

    Total Time: 2 sec

  9. #24
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: long keypress When program is run background??

    Looks like you forget to link against ws32.lib. Add to .mmp:
    Code:
    LIBRARY ws32.lib

  10. #25
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    287

    Re: long keypress When program is run background??

    thank you sir for your replay

    i added LIBRARY ws32.lib in .mmp as you said the 70% errors are corrected
    but still i have the following errors


    Errors caused tool to abort.
    make[1]: *** [\Symbian\9.2\S60_3rd_FP1_3\EPOC32\RELEASE\WINSCW\UDEB\presskey.exe] Error 1
    make: *** [TARGETPRESSKEY] Error 2
    make -j 4 -s -r -f "\Symbian\9.2\S60_3rd_FP1_3\EPOC32\BUILD\Symbian\Carbide\workspace3\presskey\group\PRESSKEY\WINSCW\PRESSKEY.WINSCW" UDEB
    presskey.UID.CPP
    mwldsym2.exe: Undefined symbol: 'class CApaWindowGroupName * CApaWindowGroupName::NewLC(class RWsSession const &) (?NewLC@CApaWindowGroupName@@SAPAV1@ABVRWsSession@@@Z)'
    mwldsym2.exe: referenced from 'void MainL(void) (?MainL@@YAXXZ)' in presskey.cpp:69
    mwldsym2.exe: Undefined symbol: 'void CApaWindowGroupName::SetHidden(int) (?SetHidden@CApaWindowGroupName@@QAEXH@Z)'
    mwldsym2.exe: referenced from 'void MainL(void) (?MainL@@YAXXZ)' in presskey.cpp:70
    mwldsym2.exe: Undefined symbol: 'int CApaWindowGroupName::SetWindowGroupName(class RWindowGroup &) const (?SetWindowGroupName@CApaWindowGroupName@@QBEHAAVRWindowGroup@@@Z)'
    mwldsym2.exe: referenced from 'void MainL(void) (?MainL@@YAXXZ)' in presskey.cpp:71

  11. #26
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: long keypress When program is run background??

    Try to add to .mmp
    Code:
    LIBRARY apgrfx.lib

  12. #27
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    287

    Re: long keypress When program is run background??

    thank you somuch for your help

    almost all the errors are rectified
    when the program is running on emulator

    " Application Closed ncnlist kern-EXEC 3" is show

    the build configration used is "Emulator Debug(WINSCW)[S60_3rd_FP1]"

  13. #28
    Nokia Developer Champion
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    3,348

    Re: long keypress When program is run background??


  14. #29
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    287

    Re: long keypress When program is run background??

    sir , here i m including my "keypress" program when 5 is long pressed the sms is to be sent please tell me what procedure should i follow


    #include "presskey.h"
    #include <e32base.h>
    #include <e32std.h>
    #include <e32cons.h>
    #include <w32std.h>
    #include <apgwgnam.h>
    // Constants

    _LIT(KTextConsoleTitle, "Console");
    _LIT(KTextFailed, " failed, leave code = %d");
    _LIT(KTextPressAnyKey, " [press any key]\n");

    // Global Variables

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


    // Local Functions

    LOCAL_C void MainL()
    {
    //
    // add your program code here, example code below
    //

    // connect to window server
    TTime iStartTime;
    TTime iEndTime;
    TTimeIntervalMicroSeconds iInterval;
    TTimeIntervalMicroSeconds minIntervalRequiered = TTimeIntervalMicroSeconds(2 * 1000 * 1000); //two seconds

    // connect to window server
    RWsSession ws;
    TKeyCode keyCode = EKeyApplication0;
    User::LeaveIfError(ws.Connect());
    CleanupClosePushL(ws);


    TRequestStatus status;

    // create a window group for the thread
    RWindowGroup wg(ws);
    wg.Construct((TUint32)&wg, EFalse);
    CleanupClosePushL(wg);


    // capture a key up and down events
    User::LeaveIfError(wg.CaptureKeyUpAndDowns(EStdKeyApplication19, 0, 0)); // scan code of camera button is EStdKeyApplication19

    // listen for the key presses
    ws.EventReady(&status);


    // hide this window group from the app switcher
    wg.SetOrdinalPosition(-1);
    wg.EnableReceiptOfFocus(EFalse);
    CApaWindowGroupName* wn=CApaWindowGroupName::NewLC(ws);
    wn->SetHidden(ETrue);
    wn->SetWindowGroupName(wg);


    // handle key events
    for(; {
    User::WaitForAnyRequest(); //wait for events
    if (status.Int()==KErrNone) { //if not error
    TWsEvent e;
    ws.GetEvent(e);

    TInt eventType;
    eventType = e.Type();

    if(eventType == EEventKeyDown){
    iStartTime.UniversalTime(); //key down time
    }
    else if (eventType == EEventKeyUp){
    iEndTime.UniversalTime(); //key up time
    iInterval = iEndTime.MicroSecondsFrom(iStartTime); //difference = duration of the press
    if (iInterval> minIntervalRequiered)
    {
    console = Console::NewL(KTextConsoleTitle, TSize(KConsFullScreen,KConsFullScreen));
    console->Write(_L("Long key press, press 5 to end daemon\n"));
    keyCode = console->Getch();
    delete console;
    }
    }

    // if not ours, then send to top window group
    // note that this breaks key repeat :-(
    TInt wgid=ws.GetFocusWindowGroup();
    ws.SendEventToWindowGroup(wgid, e);
    }
    ws.EventReady(&status);

    // stop condition
    if (keyCode == EStdKeyF11){ break; }
    }

    // clean up
    ws.EventReadyCancel();
    CleanupStack::PopAndDestroy(3); //ws, wg, wn





    //console->Write(_L("Hello, world!\n"));
    }

    LOCAL_C void DoStartL()
    {
    // Create active scheduler (to run active objects)
    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
    CleanupStack::PushL(scheduler);
    CActiveScheduler::Install(scheduler);

    MainL();

    // Delete active scheduler
    CleanupStack::PopAndDestroy(scheduler);
    }

    // Global Functions

    GLDEF_C TInt E32Main()
    {
    // 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;
    }

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

    Re: long keypress When program is run background??

    sir,
    when the program is running in emulator there is no output is this only work in phone

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
  •  
×