使用RScheduler类调度基于DLL或EXE的任务需要如下处理: 在模拟器上调度基于DLL的任务,需要完成: Code: //MyDll.cpp LOCAL_D TInt StartDLL(TAny* aParam) { CMyDll* self = new(ELeave) CMyDll; self->Test(); return(KErrNone); } TInt CMyDll::Test() { return KErrNone; } EXPORT_C TThreadFunction ThreadFunction() { // Ordinal one export that returns the function // which extracts the pseudo-command line // under WINS, this is passed as thread data). return StartDLL; } GLDEF_C TInt E32Dll(TDllReason /*aReason*/) { return(KErrNone); } 传递到StartDLL中的参数按如下方法使用以便生成SCheduledTask对象 Code: TFileName* fileName = reinterpret_cast(aParam); CcFileStore* store = CDirectFileStore::OpenLC(iFsSession, fileName, EFileRead); RStoreReadStream instream; instream.OpenLC(*store, store->Root()); // Get task count TInt count = instream.ReadInt32L(); __ASSERT_ALWAYS(count > 0, Panic(ETaskExePanicNoScheduledTasks)); for (TInt i=0;i { CScheduledTask* task = CScheduledTask::NewLC(instream); } 在目标设备上调度基于EXE的任务,可以如下处理: Code: GLDEF_C TInt E32Main() { TBuf<256> cmd; RProcess().CommandLine(cmd); return Test(cmd); } LOCAL_C TInt Test(TDesC& aTaskDataFile) { // Extract scheduled tasks as shown above. } |
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10294527/viewspace-126377/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10294527/viewspace-126377/
本文详细介绍了在模拟器及目标设备上使用RScheduler类调度基于DLL或EXE任务的具体实现方法,包括如何通过代码创建并启动任务,以及如何解析任务文件。
2707

被折叠的 条评论
为什么被折叠?



