[DllImport("ole32.dll", EntryPoint = "CoCreateInstance", CallingConvention = CallingConvention.StdCall)]
static extern UInt32 CoCreateInstance([In, MarshalAs(UnmanagedType.LPStruct)] Guid rclsid,
IntPtr pUnkOuter, UInt32 dwClsContext, [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid,
[MarshalAs(UnmanagedType.IUnknown)] out object rReturnedComObject);
[DllImport("ole32.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int CoInitialize(IntPtr pvReserved);
CoInitialize(IntPtr.Zero);
Guid vGuidIme = new Guid("2BF34C1A-8CAC-419F-8547-32FDF6505DB8");
UInt32 vError;
uint CLSCTX_SERVER = 0x4;
Guid vGuidLanguage = new Guid("CDA8ACB0-8CF5-4F6C-9BA2-5931D40C8CAE");
object vPPV;
vError = CoCreateInstance(vGuidLanguage, IntPtr.Zero, (uint)0x4, vGuidLanguage, out vPPV);
vPPV总是为NULL,操作系统安装了传真服务组件,项目里引用了fxcomex.dll组件,
现在需要通过CoCreateInstance方法创建FaxServer对象,
Windows?7 Visual?Studio?2010 faxserver fxcomex.dll vs2010
------解决方案--------------------
组件没有注册,你这种方式是最原始的C++调用com组件的方式,.net下没必要这么做,这么做是给自己找麻烦