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.

4

1 回答 1

3

该接口是 Windows SDK 的一部分。引用不像普通的 .NET 引用那样直接。您需要使用如下 COM 导入声明它:

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

你确定你需要实现那个接口吗?

于 2013-05-03T22:59:48.897 回答