登 录
#include <e32base.h> #include <e32cons.h> //-------------------------------------------------------------- // Comment 1: // // 1. CConsoleBase is defined in e32cons.h // 2. It is the interface for use console // 3. Use the factory function Console::NewL to create CConsoleBase object // 4. The class Console defined in e32base.h has only one public static // function NewL used to create CConsoleBase. //-------------------------------------------------------------- LOCAL_D CConsoleBase *gConsole; void MainL() { gConsole->Printf(_L("Hello, world!/n")); } void ConsoleMainL() { //-------------------------------------------------------------- // Comment 2 // // 1. TSize is a class defined in e32std.h // 2. TSize has two public members, iWidth and iHeight, // defining the size of a RECT block // 3. KConsFullScreen is -1 and defined in e32cons.h // 4. The size of TSize initialized by -1 (KConsFullScreen) is the // same as the screen size of the cell phone. //-------------------------------------------------------------- gConsole = Console::NewL(_L("Hello Text"), TSize(KConsFullScreen, KConsFullScreen)); CleanupStack::PushL(gConsole); MainL(); User::After(5000 * 1000); CleanupStack::PopAndDestroy(gConsole); } GLDEF_C TInt E32Main() { //-------------------------------------------------------------- // Comment 3 // // 1. __UHEAP_MARK and __UHEAP_MARKEND is used to mark // a thread heap, but it's only available in debug mode. // 2. CTrapCleanup is used to create cleanup stack framework. // 3. cleanup stack framework only need to create in console // application, GUI and server applications will create them // automatically. //-------------------------------------------------------------- __UHEAP_MARK; CTrapCleanup *cleanupStack = CTrapCleanup::New(); TRAPD(error, ConsoleMainL()); __ASSERT_ALWAYS(!error, User::Panic( _L("SCMP"), error)); delete cleanupStack; __UHEAP_MARKEND; return 0; }
抱歉!评论已关闭.