Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

IEnumWorkItems (Interfaces)
 
.
Summary
Part of the Task Scheduler 1.0 Interfaces, which consists of IEnumWorkItems, ITask, ITaskScheduler, ITaskTrigger and IScheduledWorkItem. There is some helper code below for actually using the iterator as the marshalling seemed impossible without resorting to the unmanaged helper functions in System.Runtime.InteropServices.Marshal. Not all methods have been tested, so be careful!
Summary
Part of the Task Scheduler 1.0 Interfaces, which consists of IEnumWorkItems, ITask, ITaskScheduler, ITaskTrigger and IScheduledWorkItem. There is some helper code below for actually using the iterator as the marshalling seemed impossible with resorting to the unmanaged helper functions in System.Runtime.InteropServices.Marshal. Not all methods have been tested, so be careful!

C# Definition:

    [Guid("148BD528-A2AB-11CE-B11F-00AA00530503"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IEnumWorkItems
    {
    int Next(uint celt, out IntPtr names,out uint namecount);
    int Skip(uint celt);
    int Reset() ;
    int Clone([MarshalAs(UnmanagedType.IUnknown)] out object EnumWorkItems);
    };

Helper Code

    using System;
    using System.Collections.Generic;
    using System.Runtime.InteropServices;

    static public List<string> TaskList(ITaskScheduler taskscheduler)
    {
    object obj;

    taskscheduler.Enum(out obj);

    IEnumWorkItems enumerator = obj as IEnumWorkItems;
    uint       nameCount;
    IntPtr     namePtr;
    List<string>   list       = new List<string>();

    while (enumerator.Next(1, out namePtr, out nameCount) == 0 && nameCount == 1)
    {
        IntPtr name = Marshal.ReadIntPtr(namePtr);

        list.Add(Marshal.PtrToStringUni(name));

         Marshal.FreeCoTaskMem(namePtrPtr);
         Marshal.FreeCoTaskMem(namePtr);
    }

    return list;
    }

VB Definition:

<ComImport> _
<Guid("TODO")> _
'TODO: Insert <InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _ if this doesn't derive from IDispatch
Interface IEnumWorkItems
   TODO
End Interface

User-Defined Types:

None.

Notes:

None.

Documentation

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • alternate definitions?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions