我没有使用codewarrior的模板,自建了一个空白的工程,但是模拟器中一运行到返回new CEikApplication时就会报Reason code :user Reason number:23,奇怪.
1.JReader.cpp
2.JReader.hCode:#include "JReader.h" EXPORT_C CApaApplication* NewApplication() { return new CReader_Application; //return NULL; } GLDEF_C TInt E32Dll(TDllReason /*aReason*/) { return KErrNone; }
3.JReader_ApplicationCode:#ifndef __JReader_H #define __JReader_H #include <e32std.h> #include <apparc.h> #include <qikdocument.h> #include <eikapp.h> #include <qikdocument.h> #include <qikapplication.h> #include <qikappui.h> #include <eikappui.h> #include <eikenv.h> #include <coecntrl.h> #include <bautils.h> #include <barsread.h> #include <JREADER.rsg> #include "JREADER.hrh" #include <BARSREAD.h> #include <eikmenup.h> //UIQ APPLICATION class CReader_Application : public CQikApplication { TUid AppDllUid() const; CApaDocument* CreateDocumentL(); }; //UIQ DOCUMENT class CReader_Document : public CQikDocument { //constructor public: CReader_Document(CReader_Application& aApp); private: CEikAppUi* CreateAppUiL(); }; //UIQ APPUI class CReader_AppUi : public CQikAppUi { public : void ConstructL(); ~CReader_AppUi(); // void DynInitMenuPaneL(TInt aMenuId, CEikMenuPane* aMenuPane); private: void HandleCommandL(TInt aCommand); }; class CReader_AppView : public CCoeControl { public: static CReader_AppView* NewL(const TRect& aRect); ~CReader_AppView(); void ConstructL(const TRect& aRect); private: void Draw(const TRect& aRect) const; }; #endif;
4.JReader_AppUiCode:#include "JReader.h" const TUid KUidJReader = {0X101F74A8}; TUid CReader_Application::AppDllUid() const { return KUidJReader; } CApaDocument* CReader_Application::CreateDocumentL(){ return new(ELeave) CReader_Document(*this); //return NULL; }
5.JReader_DocumentCode:#include "JReader.h" void CReader_AppUi::ConstructL(){ BaseConstructL(); } CReader_AppUi::~CReader_AppUi() { } void CReader_AppUi::HandleCommandL(TInt aCommand){ switch(aCommand){ case 0: Exit(); break; } }
6.JReader_AppViewCode:#include "JReader.h" CReader_Document::CReader_Document(CReader_Application& aApp) :CQikDocument(aApp) { } CEikAppUi* CReader_Document::CreateAppUiL(){ return new (ELeave) CReader_AppUi; }
7.JReader.rssCode:#include "JReader.h" static CReader_AppView* NewL(const TRect& aRect){ CReader_AppView* self = new(ELeave) CReader_AppView(); CleanupStack::PushL(self); self->ConstructL(aRect); CleanupStack::Pop(); return self; } void CReader_AppView::ConstructL(const TRect& aRect){ CreateWindowL(); SetRect(aRect); ActivateL(); } void CReader_AppView::Draw(const TRect& aRect) const{ }
Code:// Simple.RSS // // Copyright (c) 1997-2002 Symbian Ltd. All rights reserved. // NAME JRAD #include <eikon.rh> #include <eikcore.rsg> #include <qikon.rh> #include <aiftool.rh> #include "JReader.hrh" RESOURCE AIF_DATA { // captions caption_list= { CAPTION { code=ELangEnglish; caption="Hello"; }, CAPTION { code=ELangFrench; caption="Bonjour"; } }; }

Reply With Quote

