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
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
Hello,
yes it is possible
How_to_capture_Keyevents_in_thread_or_exe
Sending_SMS_in_S60_3rd_Edition_-_MTM
good luck
Also you can check this article - Global Long Key Capture - Capture long presses
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.
Sir
thank you for your replay. sir i m using Carbide c++ IDE i cannot create .sis file from .pkg file
What errors you are getting?i m using Carbide c++ IDE i cannot create .sis file from .pkg file
the error message are:
Error : Cannot find file : $(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\myproject.exe
myproject_EKA2.pkg(23) : error: file I/O fault.
It seems the compilation process failed.
You can check "Console" tab on Carbide.c++ IDE. All error messages may be found there.
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:
While I am checking Console I got this: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.
I am totally blocked here. Please tell me the solution.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
Thanks in advance.
Check in Wiki - Common build problems in Symbian C++
Hi,
Thank you for your valid reply.
Now I am blocked with a single error that regarding to the
issue.Code:CApaApplication* NewApplication() { return new KeyPress; }
My application name is keyPress. I am also giving my keyPress.mmp file below.
I am waiting for your reply.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
Regards,
arun
For "Emulator Debug (WINSCW)" configuration you don't need to make sis files.Originally Posted by arun09
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
As I said try to check "Console" tab on Carbide.c++ IDE. And see console output from beginning.Originally Posted by arun09
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