commonframework.h

来自「SYMBIAN中经典丛书何伟的实例代码」· C头文件 代码 · 共 61 行

H
61
字号
//
// Copyright (c) 2005 NEUSOFT Institute of inforamtion technology ChenDu.
// All rights reserved.
//
// CommonFramework.h
// the common framework for all the program
//
// Version 1.0
// by YangZongde
// 2005-9-28

#ifndef __CommonFramework_H				//compile pretreatment
#define __CommonFramework_H

#include <e32base.h>					//inclde the base library
#include <e32cons.h>
_LIT(KTxtEPOC32EX,"EXAMPLE");
_LIT(KTxtExampleCode, "EXAMPLE");
_LIT(KFormatFailed,"failed:leave code=%d");
_LIT(KTxtOK,"OK");
_LIT(KTxtPressAnyKey,"[press any key]");

//public
LOCAL_D CConsoleBase* console;				//declare the variable
LOCAL_C void doExampleL();				//declare the function

//private
LOCAL_C void callExampleL();

GLDEF_C TInt E32Main()					//the entry of program
{
	__UHEAP_MARK;					//heap check beginner
	CTrapCleanup* cleanup=CTrapCleanup::New();	//the cleanup
	TRAPD(error,callExampleL());			//trap if error
	__ASSERT_ALWAYS(!error,User::Panic(KTxtEPOC32EX,error));	//if error=1 ,invoke the panic
	delete cleanup;					//delete 
	__UHEAP_MARKEND;				//heap checkend,if error,invoke the panic
	return 0;
}

LOCAL_C void callExampleL()
{
	console=Console::NewL(KTxtExampleCode,TSize(KConsFullScreen,KConsFullScreen));
	CleanupStack::PushL(console);			//pushl the pointer to stack
	TRAPD(error,doExampleL());			//trap if error
	if(error)
		console->Printf(KFormatFailed,error);
	else
		console->Printf(KTxtOK);
	console->Printf(KTxtPressAnyKey);
	console->Getch();				//wait user press any key
	CleanupStack::PopAndDestroy(console);		
}

#endif





⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?