Domanda

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.

È stato utile?

Soluzione

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?

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top