一个关于COM接口的很简单的问题,高手们闭着眼睛都可以回答的 只知一个Interface的GUID为"6C44DF74-72B9-4992-A1EC-EF996E0422D4",其它的什么都不知道的情况下,怎么得到它的CComPtr指针?请指教,谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你如果不知道CLSID的话,那么就意味着不能创建相应的实例,所以当然不能得到。相关原理可以看看讲COM的书。 1.在HKEY_CLASSES_ROOT\Interface\ 找到 项“6C44DF74-72B9-4992-A1EC-EF996E0422D4”2.在其项TypeLib下找到GUID是CLSID3.在HKEY_CLASSES_ROOT\CLSID\ 找到 该CLSID_GUID其中 如果是进程外则找\localserver其中就是本地COM组件 如果是进程内找\InProcServer324.注册你的DLL yourcom.dll -regserver325.#import "youcom.dll" no_namespace6.定义 yourcomclassPtr cominter7.cominter.cocreateinstance()......//调用8.cominter.Release(); volcary((冰火山):我在导出类型库时出错,我是想导出MICROSOFT TTS 引擎的,在StdAfx.h中加入#import "C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll" no_namespace后编译出错,提示如下:Compiling...StdAfx.cppd:\abcddd\b\stdafx.h(23) : warning C4192: automatically excluding 'wireHWND' while importing type library 'C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll'd:\abcddd\b\stdafx.h(23) : warning C4192: automatically excluding '_RemotableHandle' while importing type library 'C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll'd:\abcddd\b\stdafx.h(23) : warning C4192: automatically excluding '__MIDL_IWinTypes_0009' while importing type library 'C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll'd:\abcddd\b\stdafx.h(23) : warning C4192: automatically excluding 'IStream' while importing type library 'C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll'd:\abcddd\b\stdafx.h(23) : warning C4192: automatically excluding 'ISequentialStream' while importing type library 'C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll'd:\abcddd\b\stdafx.h(23) : warning C4192: automatically excluding '_LARGE_INTEGER' while importing type library 'C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll'd:\abcddd\b\stdafx.h(23) : warning C4192: automatically excluding '_ULARGE_INTEGER' while importing type library 'C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll'd:\abcddd\b\stdafx.h(23) : warning C4192: automatically excluding 'tagSTATSTG' while importing type library 'C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll'd:\abcddd\b\stdafx.h(23) : warning C4192: automatically excluding '_FILETIME' while importing type library 'C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll'd:\abcddd\b\debug\sapi.tlh(3515) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3515) : warning C4129: 'M' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3515) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3516) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3516) : warning C4129: 'M' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3516) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3517) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3517) : warning C4129: 'M' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3517) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3517) : warning C4129: 'A' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3518) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3518) : warning C4129: 'M' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3518) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3518) : warning C4129: 'A' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3519) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3519) : warning C4129: 'M' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3519) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3519) : warning C4129: 'V' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3520) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3520) : warning C4129: 'M' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3520) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3520) : warning C4129: 'R' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3521) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3521) : warning C4129: 'M' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3521) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3521) : warning C4129: 'A' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3522) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3522) : warning C4129: 'M' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3522) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3522) : warning C4129: 'P' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3523) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3523) : warning C4129: 'M' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3523) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3523) : warning C4129: 'R' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3524) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3524) : warning C4129: 'M' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3524) : warning C4129: 'S' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3524) : warning C4129: 'C' : unrecognized character escape sequenced:\abcddd\b\debug\sapi.tlh(3551) : warning C4305: 'initializing' : truncation from 'const double' to 'const float'd:\abcddd\b\debug\sapi.tlh(4511) : error C2011: 'IServiceProvider' : 'struct' type redefinitiond:\abcddd\b\debug\sapi.tlh(6132) : warning C4146: unary minus operator applied to unsigned type, result still unsignedd:\abcddd\b\debug\sapi.tlh(6695) : error C2039: 'RemoteQueryService' : is not a member of 'IServiceProvider' c:\program files\microsoft visual studio\vc98\include\servprov.h(108) : see declaration of 'IServiceProvider'Error executing cl.exe.Creating browse info file...b.exe - 2 error(s), 49 warning(s) 有重定义发生,你可以去掉no_namespace参数,这样你使用的时候注意要加上namespace就可以了。 maphis(bool bPoor=true) :谢谢你,谢谢你,太感谢你了!!!(真想亲你一口) 谁有电机自动控制界面 关于字符删除的问题 多端口的问题 关于分割窗口的问题? 不能插入一个有效的位图 MFC平台搭建 ActiveForm在IE中不停的重画?请问为什么????? 同一个结构,16位下和32位下用sizeof()获取的长度不一样? vc安装问题 用DAO的程序在其它计算机上执行时出现"建立空文档失败!"为什么? 如何将CRichEditCtrl的内容输出到打印机? 高分求救!!急急急急急急急急急!!!!
项“6C44DF74-72B9-4992-A1EC-EF996E0422D4”
2.在其项TypeLib下找到GUID是CLSID
3.在HKEY_CLASSES_ROOT\CLSID\ 找到 该CLSID_GUID其中
如果是进程外则找\localserver其中就是本地COM组件
如果是进程内找\InProcServer32
4.注册你的DLL yourcom.dll -regserver32
5.#import "youcom.dll" no_namespace
6.定义 yourcomclassPtr cominter
7.cominter.cocreateinstance()
......//调用
8.cominter.Release();
我在导出类型库时出错,我是想导出MICROSOFT TTS 引擎的,在StdAfx.h中加入
#import "C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll" no_namespace
后编译出错,提示如下:
Compiling...
StdAfx.cpp
d:\abcddd\b\stdafx.h(23) : warning C4192: automatically excluding 'wireHWND' while importing type library 'C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll'
d:\abcddd\b\stdafx.h(23) : warning C4192: automatically excluding '_RemotableHandle' while importing type library 'C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll'
d:\abcddd\b\stdafx.h(23) : warning C4192: automatically excluding '__MIDL_IWinTypes_0009' while importing type library 'C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll'
d:\abcddd\b\stdafx.h(23) : warning C4192: automatically excluding 'IStream' while importing type library 'C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll'
d:\abcddd\b\stdafx.h(23) : warning C4192: automatically excluding 'ISequentialStream' while importing type library 'C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll'
d:\abcddd\b\stdafx.h(23) : warning C4192: automatically excluding '_LARGE_INTEGER' while importing type library 'C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll'
d:\abcddd\b\stdafx.h(23) : warning C4192: automatically excluding '_ULARGE_INTEGER' while importing type library 'C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll'
d:\abcddd\b\stdafx.h(23) : warning C4192: automatically excluding 'tagSTATSTG' while importing type library 'C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll'
d:\abcddd\b\stdafx.h(23) : warning C4192: automatically excluding '_FILETIME' while importing type library 'C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll'
d:\abcddd\b\debug\sapi.tlh(3515) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3515) : warning C4129: 'M' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3515) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3516) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3516) : warning C4129: 'M' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3516) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3517) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3517) : warning C4129: 'M' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3517) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3517) : warning C4129: 'A' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3518) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3518) : warning C4129: 'M' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3518) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3518) : warning C4129: 'A' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3519) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3519) : warning C4129: 'M' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3519) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3519) : warning C4129: 'V' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3520) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3520) : warning C4129: 'M' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3520) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3520) : warning C4129: 'R' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3521) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3521) : warning C4129: 'M' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3521) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3521) : warning C4129: 'A' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3522) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3522) : warning C4129: 'M' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3522) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3522) : warning C4129: 'P' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3523) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3523) : warning C4129: 'M' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3523) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3523) : warning C4129: 'R' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3524) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3524) : warning C4129: 'M' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3524) : warning C4129: 'S' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3524) : warning C4129: 'C' : unrecognized character escape sequence
d:\abcddd\b\debug\sapi.tlh(3551) : warning C4305: 'initializing' : truncation from 'const double' to 'const float'
d:\abcddd\b\debug\sapi.tlh(4511) : error C2011: 'IServiceProvider' : 'struct' type redefinition
d:\abcddd\b\debug\sapi.tlh(6132) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\abcddd\b\debug\sapi.tlh(6695) : error C2039: 'RemoteQueryService' : is not a member of 'IServiceProvider'
c:\program files\microsoft visual studio\vc98\include\servprov.h(108) : see declaration of 'IServiceProvider'
Error executing cl.exe.
Creating browse info file...b.exe - 2 error(s), 49 warning(s)