不注册直接使用COM组件的方法
来源:互联网 发布:好玩的桌面软件 编辑:程序博客网 时间:2024/05/17 06:26
不注册直接使用COM组件的方法
1. 定义导出函数指针
- //定义函数指针
- typedef HRESULT (_stdcall *Func) (REFCLSID , REFIID , LPVOID*);
- Func g_DllGetClassObject=NULL;
2.导出COM组件这个DLL 的 DllGetClassObject函数
- if (g_DllGetClassObject==NULL)
- {
- CString strParam = theApp.strRootDirectory + TEXT("//MMGifCtrl.dll");
- HMODULE module=LoadLibrary(strParam.GetBuffer(0));
- if (module!=NULL)
- {
- g_DllGetClassObject= (Func) GetProcAddress(module,"DllGetClassObject");
- }
- }
3.通过 DllGetClassObject 获得COM的类厂 ,然后通过类厂获得所要的接口
- IMMGifCtrl * pShowGif = NULL;
- CComQIPtr<IClassFactory> pGifFactory;
- HRESULT hr;
- //如果 g_DllGetClassObject不为空
- if (g_DllGetClassObject)
- {
- hr= g_DllGetClassObject(__uuidof(CMMGifCtrl), IID_IClassFactory,(LPVOID*)&pGifFactory);
- if (hr ==S_OK)
- {
- pGifFactory->CreateInstance(NULL,__uuidof(IMMGifCtrl),(LPVOID*)&pShowGif);
- if (pShowGif)
- {
- //成功获得COM接口
- }
- }
- }
0 0
- 不注册直接使用COM组件的方法
- 不注册直接使用COM组件的方法
- 不注册直接使用COM组件的方法
- 不注册直接使用COM组件的方法
- 不注册COM组件直接调用接口
- 不注册COM组件直接调用接口
- 使用注册COM 组件 方法
- COM+组件注册方法
- COM 组件注册方法
- COM+组件注册方法
- 两种注册COM组件的方法
- 在.NET应用程序中不注册使用ocx Com组件
- Delphi中不进行组件注册而直接调用COM对象
- .com组件客户端注册方法
- COM+组件注册方法浅谈
- COM组件注册方法(VC++)
- WIN2K下COM组件的反注册方法。
- 调用DllRegisterServer方法进行COM组件的注册
- C语言 二叉树相关
- 二维码读取与扫描
- android 帧布局实现跑马灯
- 如何修改单卡和双卡工程的默认数据连接开关
- Fireworks in Montreal
- 不注册直接使用COM组件的方法
- 杭电2014评分数组快排法和基本法
- [LeetCode]9.Palindrome Number
- javascript深入理解js闭包
- Notification用法
- If not, then the process of what would be my future
- JavaEE----Action接受请求参数
- Apache Pig入门学习文档(一)
- keytool命令总结