Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

How can I schedule tasks based on DLL or EXE using Symbian C++?

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.


Article Metadata
Compatibility
Platform(s): S60 1st Edition
S60 2nd Edition
S60 2nd Edition (initial release)
S60 1st Edition
Article
Created: User:Technical writer 2 (12 Feb 2004)
Last edited: lpvalente (17 Nov 2012)

Overview

How can I schedule tasks based on DLL or EXE?

Description

Scheduling DLL or EXE-based tasks using the RScheduler class requires a certain technique to implement the EXE and DLL.

Solution

To schedule a DLL-based task in the emulator, implement the DLL as follows:

//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);
}

Further information: The aParam passed in StartDLL can be used as follows to create CScheduledTask objects:

TFileName* fileName = reinterpret_cast<TFileName*>(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<count;i++)
{
CScheduledTask* task =
CScheduledTask::NewLC(instream);
}
To schedule an EXE-based task in the device, implement the EXE as follows:
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.
}
This page was last modified on 17 November 2012, at 21:31.
26 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×