在Symbian exe 程序中显示图形
2010-05-06 21:39:00 来源:WEB开发网function is called by the framework, the CCoeAppUi (from where the application's AppUi
derives) creates the control stack, view manager, etc. and the CCoeControl derived class
will create a window (RWindow) to provide a basic view. As you can see, this snippet
provides all this basic functionality at once, without extra bloat such as a control stack,
etc. which aren't needed in this simple case. I haven't included comments, as most of the
code speaks by itself.
当CONE环境建立后设置清理栈活动对象规划器(CCoeScheduler),建立和文件,窗口服务器的会话(以后
会在调用CCoeEnv::FsSession() 和 CCoeEnv::WsSession()时用到)。接着创建屏幕,窗口组和图形上
下文。再下来,在工厂函数NewApplication()被框架调用后,CCoeAppUi (来自应用程序的AppUi驱动)
建立控件栈,视图管理器等等。CCoeControl的继承类将建立窗口(RWindow)来提供基本的视图。就像你
所看到的,这个程序片断只提供了所以基本的功能,并没有像控件栈等这些多余的东西,它们是这个简
单例子程序中所不需要的。我们并没有注释,因为代码本身已经说明问题了。
LOCAL_C void ExeMainL()
{
RWsSession ws;
User::LeaveIfError(ws.Connect());
CleanupClosePushL(ws);
CWsScreenDevice* screen = new(ELeave) CWsScreenDevice(ws);
CleanupStack::PushL(screen);
screen->Construct();
RWindowGroup wg(ws);
User::LeaveIfError(wg.Construct(reinterpret_cast
CleanupClosePushL(wg);
wg.SetOrdinalPosition(10, ECoeWinPriorityAlwaysAtFront);
CWindowGc* gc;
User::LeaveIfError(screen->CreateContext(gc));
CleanupStack::PushL(gc);
RWindow window(ws);
User::LeaveIfError(window.Construct(wg, reinterpret_cast
CleanupClosePushL(window);
更多精彩
赞助商链接