Exe with No console window??
| Tue, 2006-03-21 12:56 | |
|
I'm creating an exe like this:
#include <e32base.h> #include <e32cons.h> _LIT(KTxtMyExe,"MyExe"); _LIT(KFormatFailed,"failed: leave code=%d"); // public LOCAL_D CConsoleBase* console; // write all your messages to this // private LOCAL_C void callMainL(); // initialize with cleanup stack, then do example GLDEF_C TInt E32Main() // main function called by E32 { __UHEAP_MARK; CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack TRAPD(error,callMainL()); // more initialization, then do example __ASSERT_ALWAYS(!error,User::Panic(KTxtMyExe,error)); delete cleanup; // destroy clean-up stack __UHEAP_MARKEND; return 0; // and return } LOCAL_C void callMainL() // initialize and call example code under cleanup stack { console=Console::NewL(KNullDesC,TSize(KDefaultConsWidth,KDefaultConsHeight)); CleanupStack::PushL(console); console->Getch(); // get and ignore character CleanupStack::PopAndDestroy(); // close console } When i try to change the size of console here: console=Console::NewL(KNullDesC,TSize(KDefaultConsWidth,KDefaultConsHeight)); it gets crash.... What i want is: exe with no console window. Is it possible? Thanks ahead! |
|






Forum posts: 176
iWindowGroup->Construct((TUint32) iWindowGroup, EFalse);
iWindowGroup->SetOrdinalPosition(-1);
iWindowGroup->EnableReceiptOfFocus(EFalse);
iWindowGroupName = CApaWindowGroupName::NewL(iWsSession);
iWindowGroupName->SetHidden(ETrue);
iWindowGroupName->SetWindowGroupName(*iWindowGroup);
Now your program will do something without any window...
Was that your intention?
regards;
CG
iWindowGroup->Construct((TUint32) iWindowGroup, EFalse);
iWindowGroup->SetOrdinalPosition(-1);
iWindowGroup->EnableReceiptOfFocus(EFalse);
iWindowGroupName = CApaWindowGroupName::NewL(iWsSession);
iWindowGroupName->SetHidden(ETrue);
iWindowGroupName->SetWindowGroupName(*iWindowGroup);
Now your program will do something without any window...
Was that your intention?
regards;
CG
Tnx for reply CG
Where exactly i need to add this code?
Do i still need this: console=Console::NewL(KNullDesC,TSize(KDefaultConsWidth,KDefaultConsHeight));
What is "iWsSession"?
I want my program to run in bacground , having no visible window and not being shown in task-list.
Forum posts: 276
remove all the code related to CConsoleBase....
And I don't see anything wrong in your code.... What exactly you mean by crash... is it a leave or panic?
Today is a gift by GOD, that's why it is called the present.
remove all the code related to CConsoleBase....
And I don't see anything wrong in your code.... What exactly you mean by crash... is it a leave or panic?
i removed all code related to console.... now in emulator i see
blue color screen only. havnt test how it'll be on device.
Forum posts: 276
Today is a gift by GOD, that's why it is called the present.
i tested on device and its working fine
My exe monitors incomming sms, it gets notify when sms receives. but i'm facing a problem when getting messaging body text.
i made an application (.app) before where i was getting messaging text like this:
if (store->HasBodyTextL())
{
CRichText* richText = CRichText::NewL(
iEikonEnv->SystemParaFormatLayerL(),
iEikonEnv->SystemCharFormatLayerL());
CleanupStack::PushL(richText);
store->RestoreBodyTextL(*richText);
// rich text contains message body text
CleanupStack::PopAndDestroy(richText);
}
but this way dont work with .exe . i'm getting following errors:
error C2065: 'iCoeEnv' : undeclared identifier
error C2440: 'static_cast' : cannot convert from 'int' to 'class CEikonEnv *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
error C2227: left of '->SystemParaFormatLayerL' must point to class/struct/union
error C2440: 'static_cast' : cannot convert from 'int' to 'class CEikonEnv *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
error C2227: left of '->SystemCharFormatLayerL' must point to class/struct/union
Error executing cl.exe.
What should i do to fix it?
I want to monitor MMS&E-mails too in exe, is it good to have all this in one .exe or i should have running different .exe to monitor each type (sms,mms,e-mails)
Forum posts: 276
just simple read the message body with the help of client MTM...
check the following e.g.
iSmsMtm->LoadMessageL(); // load the message
CRichText& body = iSmsMtm->Body();
TPtrC msg(body.Read(0));
Today is a gift by GOD, that's why it is called the present.
Forum posts: 276
I think you can monitor each of them in a single exe... no need to create separate exe for each of them...
Today is a gift by GOD, that's why it is called the present.
I think you can monitor each of them in a single exe... no need to create separate exe for each of them...
tnx for reaply dennis
one thing which i'm not understanding is: when sms arrives i can be notified, but how i'll get notified of e-mail.
As far as i understand u need to fetch them from server??
could u plz guide me?
Forum posts: 2
Is there any possible way to avoid this behaviour?
Forum posts: 71
kostas.perifanos
did u solve your problem if no then you can contact me by the forum.
Regards,
JKS
Forum posts: 80
hello dennis_george,
I have created an exe for receiving SMSs.
But when I try to read the details of the received SMS, I get a KERN-EXEC 3 panic...
I am also using the same code as u have suggested:
iSmsMtm->SwitchCurrentEntryL(aEntryId);
iSmsMtm->LoadMessageL(); // load the message
CRichText& body = iSmsMtm->Body();
TPtrC msg(body.Read(0));
The panic occurs at the first line of code.
Can anyone help out with this???
Forum posts: 2009
The code in itself is ok. Have you correctly initialized iSmsMtm ?
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant
Forum posts: 80
Yes, I have used the same code as in the smssend example in the S60 2nd edition SDK for FP2.
iSmsMtm is initialized as follows after the EMsvServerReady event occurs:
iSmsMtm = STATIC_CAST( CSmsClientMtm*, iMtmRegistry->NewMtmL( KUidMsgTypeSMS ) );
PS: I have already tested this code in a GUI application. I don't know why its not working in an EXE!
Forum posts: 2009
Yes it does. As far as I can remember, we have used it in a couple of EXEs.
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant