Symbian一个活动对象的测试例子
2010-10-20 08:00:45 来源:WEB开发网~CActiveTest2NewClass();
public: // New functions
// Function for making the initial request
void StartL(TTimeIntervalMicroSeconds32 aDelay);
//就是下面两个方法Carbide.vs没提供
static CActiveTest2NewClass* NewLC();
static CActiveTest2NewClass* NewL();
private: // From CActive
// Handle completion
void RunL();
// How to cancel me
void DoCancel();
// Override to handle leaves from RunL(). Default implementation causes
// the active scheduler to panic.
//void RunError(TInt aError);
private:
enum TActiveTest2NewClassState
{
EUninitialized, // Uninitialized
EInitialized, // Initalized
EError // Error condition
};
private:
TInt iState; // State of the active object
RTimer iTimer; // Provides async timing service
TInt iCount;
};
#endif
ActiveTest2NewClass.cpp
/*
============================================================================
Name : ActiveTest2NewClass.cpp
Author :
Version :
Copyright : Your copyright notice
Description : CActiveTest2NewClass implementation
============================================================================
*/
#include "ActiveTest2NewClass.h"
#include
CActiveTest2NewClass::CActiveTest2NewClass() : CActive(EPriorityStandard) // Standard priority
{
}
void CActiveTest2NewClass::ConstructL()
{
User::LeaveIfError(iTimer.CreateLocal()); // Initialize timer
CActiveScheduler::Add(this); // Add to scheduler
}
CActiveTest2NewClass* CActiveTest2NewClass::NewLC()
{
更多精彩
赞助商链接