[ComImport, Guid("187463A0-5BB7-11d3-ACBE-0080C75E246E")]
    public class WMAsfReader
    {
    }和 [Guid("56a868c0-0ad4-11ce-b03a-0020af0ba770"),
    InterfaceType(ComInterfaceType.InterfaceIsDual)]
    public interface IMediaEventEx : IMediaEvent
    {
        #region IMediaEvent Methods        [PreserveSig]
        new int GetEventHandle([Out] out IntPtr hEvent); // HEVENT        [PreserveSig]
        new int GetEvent(
            [Out] out EventCode lEventCode,
            [Out] out int lParam1,
            [Out] out int lParam2,
            [In] int msTimeout
            );        [PreserveSig]
        new int WaitForCompletion(
            [In] int msTimeout,
            [Out] out EventCode pEvCode
            );        [PreserveSig]
        new int CancelDefaultHandling([In] EventCode lEvCode);        [PreserveSig]
        new int RestoreDefaultHandling([In] EventCode lEvCode);        [PreserveSig]
        new int FreeEventParams(
            [In] EventCode lEvCode,
            [In] int lParam1,
            [In] int lParam2
            );        #endregion        [PreserveSig]
        int SetNotifyWindow(
            [In] IntPtr hwnd, // HWND *
            [In] int lMsg,
            [In] IntPtr lInstanceData // PVOID
            );        [PreserveSig]
        int SetNotifyFlags([In] NotifyFlags lNoNotifyFlags);        [PreserveSig]
        int GetNotifyFlags([Out] out NotifyFlags lplNoNotifyFlags);
    }被封装在dll中,怎么引用后取得?

解决方案 »

  1.   

    http://msdn2.microsoft.com/zh-cn/library/system.type.guid.aspx
      

  2.   

    感谢各位能抽出时间来看我的又臭又长的叙述(横线(_____)之间的内容可以不看):
    _____________________________________________________________________________
    其实我是在做directshow的程序,网上到处都是c++的例子,而c#的sdk都没有;
    我找到个
    http://directshownet.sourceforge.net/index.html
    这个只有简单的说明,没有泛例,他说是可以用微软的msdn帮助(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directshow/htm/directshow.asp),但是我一看上面似乎没有什么有用的东西,
    它的directshow.samples没一个有源代码下载啊.我又下载了这个http://www.codeproject.com/cs/media/directshownet.asp.但似乎没有把"directshow"做成一个dll,每个范例(它有几个范例)都是直接引用了几个文件,而且似乎是一个较老的版本,写的是支持dx.8.1,而前者是支持dx9.b,所以觉得前者更好,
    ________________________________________________________________________________
    我想两者应该有共通之处,于是拿后者的例子来改,引用前者的directshow.dll:
    后者范例有这样一段
    ---------------------------------------------------------------------
    Type comtype = null;
    object comobj = null;
    try {
    comtype = Type.GetTypeFromCLSID( Clsid.FilterGraph );
    if( comtype == null )
    throw new NotSupportedException( "DirectX (8.1 or higher) not installed?" );
    comobj = Activator.CreateInstance( comtype );
    graphBuilder = (IGraphBuilder) comobj; comobj = null;

    int hr = graphBuilder.RenderFile( clipFile, null );
    ---------------------------------------------------------------------------------Clsid.FilterGraph 实际是类Clsid中的一个静态guid(public static readonly Guid FilterGraph = new Guid( 0xe436ebb3, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70 );),
    而前者几个类里面全部是定义静态的guid的,但其中没有guid值和上面那个相等的,只有一个名字相同的,但他是一个类:
    [ComImport, Guid("e436ebb3-524f-11ce-9f53-0020af0ba770")]
        public class FilterGraph
        {
        }
    它前面那个ComImport不知道是什么意思,但Guid和那个是一样的,但是我不知道怎么得到那个guid,这就是我这个题目的详细情况.我先试试上面的方法.希望哪位能介绍点c#.directshow的经验或者代码或好用的类库,谢谢!
      

  3.   

    comtype=Type.GetTypeFromCLSID(typeof(FilterGraph).GUID);