WEB开发网
开发学院手机开发Symbian 开发 Symbian一个活动对象的测试例子 阅读

Symbian一个活动对象的测试例子

 2010-10-20 08:00:45 来源:WEB开发网   
核心提示:CActiveTest2NewClass* self = new (ELeave) CActiveTest2NewClass;CleanupStack::PushL(self);self->ConstructL();return self;}CActiveTest2NewClass* CActiveTest2Ne

CActiveTest2NewClass* self = new (ELeave) CActiveTest2NewClass;

CleanupStack::PushL(self);

self->ConstructL();

return self;

}

CActiveTest2NewClass* CActiveTest2NewClass::NewL()

{

CActiveTest2NewClass* self = NewLC();

CleanupStack::Pop(self);

return self;

}

CActiveTest2NewClass::~CActiveTest2NewClass()

{

Cancel(); // Cancel any request, if outstanding

// Delete instance variables if any

}

void CActiveTest2NewClass::DoCancel()

{

iTimer.Cancel();

}

void CActiveTest2NewClass::StartL(TTimeIntervalMicroSeconds32 aDelay)

{

Cancel(); // Cancel any request, just to be sure

iState = EUninitialized;

iTimer.After(iStatus, aDelay); // Set for later

SetActive(); // Tell scheduler a request is active

}

void CActiveTest2NewClass::RunL()

{

if (iState == EUninitialized) {

// Do something the first time RunL() is called

//iState = EInitialized;

iCount++;

_LIT(TempString,"the iCount's value is :");

HBufC* iBuf = HBufC::NewLC(100);

iBuf->Des().Copy(TempString);

iBuf->Des().AppendNum(iCount);

CEikonEnv::Static()->InfoMsg(*iBuf);

CleanupStack::PopAndDestroy(iBuf);

} else if (iState != EError) {

// Do something

}

iTimer.After(iStatus, 3000000); // Set for 1 sec later

SetActive(); // Tell scheduler a request is active

}

另外就是以下几点收获:

1:debug到某一行出错并不代表就是这行的错误,可能是它上面一行,要看debug窗口里面红色显示的内容.

2:在epoc32winscsystemBootdata下面建一个ErrRd文件(无扩展名),可以让程序在关闭退出的时候报一个错误码.例如我的这个错误报kern-exec 0.之后可以到

http://www.symbian.com/developer/techlib/v70docs/SDL_v7.0/doc_source/reference/SystemPanics/index.html#PanicsReference%2eindex

上一页  1 2 3 4 5 6 

Tags:Symbian 一个 活动

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接