VC++进行COM编程.pdf

上传人:qwe****56 文档编号:70019917 上传时间:2023-01-14 格式:PDF 页数:21 大小:150.40KB
返回 下载 相关 举报
VC++进行COM编程.pdf_第1页
第1页 / 共21页
VC++进行COM编程.pdf_第2页
第2页 / 共21页
点击查看更多>>
资源描述

《VC++进行COM编程.pdf》由会员分享,可在线阅读,更多相关《VC++进行COM编程.pdf(21页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、?VCCOM?2007-8-30?COM?COM?100%?0%?EXE?DLL?Windows?DLL?Windows?DLL?(1)?DLL?DLL?(2)?C?C?DLL?VC?DLL?BC?extern C;?C?C?(3)?(4)DLL?EXE?DLL?EXE?DLL?DLL?DLL?DLL?COM?COM?DLL?COM?DLL?ActiveX?.ocx?DLL?DLL?COM?COM?DLL?DLL?COM?EXE?VC?COM?COM?COM?COM?COM?COM?COM?COM?COM?COM?VC?(?C?COM?)(1)COM?C+?C+?COM?class IObje

2、ctpublic:virtual Function1(.)=0;virtual Function2(.)=0;.;class MyObject:public IObjectpublic:virtual Function1(.).virtual Function2(.).;?IObject?MyObject?COM?COM?COM?C+?COM?VTable?(2)COM?IUnknown?IClassFactory?IDispatchCOM?IUnknown?IUnknown?QueryInterface?AddRef?Release?QueryInterface?AddRef?Release

3、?COM?COM?DLL?DLL?COM?COM?COM?COM?COM?COM?VC?AddRef?AddRef?Release?Release?QueryInterface?MSDN?AddRef?Release?IUnknown?IClassFactory?COM?COM?new?!?COM?new?128?new?new?IClassFactory?CreateInstance?API?VC?COM?VB?IDispatch?C+?VB?VJ?VBScript?JavaScript?IDispatch?:-)?COM?C+?VC?C+?VB?VB?VTable?VJ?VBScript?

4、JavaScript?COM?IDispatch?:-)?IDispatch?IDispatch?IDispatch?Invoke?Invoke?MS?Invoke?:-)(3)dispinterface?Dual?Custom?ATL?-:)?IDispatch?IDispatch?VBScript?JavaScript?COM?Invoke?VTable?IDispatch?VC?Invoke?VC?VC?IDispatch?(?dual?IDispatch?IUnknown?IDispatch?IDispatch?IUnknown?IDispatch?IUnknown?IDispatch

5、:Invoke?C+?dispinterface?IDispatch?(?)?COM?Custom?IUnknown?(4)COM?COM?DLL?COM?DLL?COM?.?WIN32?4GB?DLL?Windows?DCOM?RPC?Windows?DLL?COM?EXE?DLL?dllhost.exe?COM?DLL?MTS?DLL?MTS?DLL?COM?COM?COM+?(5)COM?IDL?COM?COM?C+?COM?C+?IDL?IDL?IDL?IDL?VC?VB?DLL?(6)COM?COM?COM?IUnknown*pUnk=NULL;IObject*pObject=NUL

6、L;CoInitialize(NULL);CoCreateInstance(CLSID_Object,CLSCTX_INPROC_SERVER,NULL,IID_IUnknown,(void*)&pUnk);pUnk-QueryInterface(IID_IOjbect,(void*)&pObject);pUnk-Release();pObject-Func();pObject-Release();CoUninitialize();CoCreateInstance?:CoCreateInstance(.).IClassFactory*pClassFactory=NULL;CoGetClassO

7、bject(CLSID_Object,CLSCTX_INPROC_SERVER,NULL,IID_IClassFactory,(void*)&pClassFactory);pClassFactory-CreateInstance(NULL,IID_IUnknown,(void*)&pUnk);pClassFactory-Release();.?IUnknown?CoGetClassObject?CoGetClassObject(.)/?CLSID_Object?DLL?/?DLL?/?GetProcAddress(.)?DLL?DllGetClassObject?/?DllGetClassOb

8、jectDllGetClassObject?.?DllGetClassObject?DllGetClassObject(.).CFactory*pFactory=new CFactory;/?pFactory-QueryInterface(IID_IClassFactory,(void*)&pClassFactory);/?IClassFactory?pFactory-Release();.CoGetClassObject?CoCreateInstance?CreateInstance?CFactory:CreateInstance(.).CObject*pObject=new CObject;/?pObject-QueryInterface(IID_IUnknown,(void*)&pUnk);pObject-Release();.?COM+?COPY?CoCreateInstance?(7)?COM DLL?DllGetClassObject:?DllRegisterServer:?DllUnregisterServer:?DllCanUnloadNow:?DLLDLL?DllMain,?COM?VC?(8)?COM?GUID?COM?GUID?GUID?128?GUID?COM?DLL?CLSID?DLL?

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 技术资料 > 其他杂项

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁