3

I need to be able to implement the IRunnableTask interface, and have no idea how. I tried adding reference to C:\Windows\System32\Shell32.dll -- no luck... google to try and find information... nothing around how to import/include in a .net project to access IRunnableTask.

I'm sure this is an easy one for someone that has used this interface before.

svick
  • 236,525
  • 50
  • 385
  • 514
wakurth
  • 1,644
  • 1
  • 23
  • 39

1 Answers1

3

That interface is part of the Windows SDK. Referencing is not as straight forward as a normal .NET reference. You need to declare it with a COM import like this:

using System.Runtime.InteropServices;

namespace Your.Namespace
{
    [ComImport]
    [Guid("85788D00-6807-11D0-B810-00C04FD706EC")]
    interface IRunnableTask
    {
        int IsRunning();
        uint Kill(bool fUnused);
        uint Resume();
        uint Run();
        uint Suspend();
    }

    class RunnableTaskImpl : IRunnableTask
    {
        public int IsRunning() { return 0; }
        public uint Kill(bool fUnused) { return 0; }
        public uint Resume() { return 0; }
        public uint Run() { return 0; }
        public uint Suspend() { return 0; }
    } 
}

Are you sure you need to implement that interface?

davmos
  • 9,324
  • 4
  • 40
  • 43
  • Yes. I'm creating a remote client multi-threaded "Managed" task WCF service. One part of the Framework I'm following as a starting point uses IRunnableTask. I guess there's a chance I won't need it in the end, but for now I'll run with it. Thanks! – wakurth May 04 '13 at 05:47