Click here to Skip to main content
15,884,836 members
Articles / Mobile Apps / Windows Mobile

Task Manager for Windows Mobile and Windows CE

Rate me:
Please Sign up or sign in to vote.
4.51/5 (23 votes)
30 Nov 2008CPOL10 min read 112.2K   7.3K   79  
Source code for writing your own Task Manager for Windows Mobile or Windows CE based devices
#pragma once

#include <atlcom.h>

// CComEnum2<> extends ATL CComEnum<> that the Next() method initializes its T parameter
template <class Base, const IID* piid, class T, class Copy, class ThreadModel = CComObjectThreadModel>
class CComEnum2 : 
    public CComEnum<Base, piid, T, Copy, ThreadModel>
{
public:
	STDMETHOD(Next)(ULONG celt, T* rgelt, ULONG* pceltFetched)
    {
        *rgelt = T();
        return CComEnum::Next(celt, rgelt, pceltFetched);
    }
};

// CComEnum2<> template class specialization where T = VARIANT
// This will overcome a bug in CF3.5 that will check erroneously VARIANT vt type
// when the last item of an IEnumVariant is checked for validity. CComEnum<> returns than S_FALSE
template <class Base, const IID* piid, class Copy, class ThreadModel/* = CComObjectThreadModel*/>
class CComEnum2<Base, piid, VARIANT, Copy, ThreadModel> : 
    public CComEnum<Base, piid, VARIANT, Copy, ThreadModel>
{
public:
	STDMETHOD(Next)(ULONG celt, VARIANT* rgelt, ULONG* pceltFetched)
    {
        VariantInit(rgelt);
        return CComEnum::Next(celt, rgelt, pceltFetched);
    }
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader
Belgium Belgium
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions