我必须维护正式使用MSXML3的旧软件。当我查找项目库的导出(使用dumpbin)时,我找到一个名为GetNodeText的函数:
560 22F 0003CA40
?GetNodeText@CBgsXML@@SA?AVCString@@V?$_com_ptr_t@V?$_com_IIID@UIXMLDOMNode@MSXML2@@$1?_GUID_2933bf80_7b36_11d2_b20e_00c04f983e60@@3U__s_GUID@@A@@@@PBD@Z
当我查看已注册的COM接口并搜索“{2933bf80-7b36-11d2-b20e-00c04f983e60}”(来自导出)时,我找到以下条目:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Interface\{2933BF80-7B36-11D2-B20E-00C04F983E60}]
@="IXMLDOMNode"
[HKEY_CLASSES_ROOT\Interface\{2933BF80-7B36-11D2-B20E-00C04F983E60}\ProxyStubClsid]
@="{00020424-0000-0000-C000-000000000046}"
[HKEY_CLASSES_ROOT\Interface\{2933BF80-7B36-11D2-B20E-00C04F983E60}\ProxyStubClsid32]
@="{00020424-0000-0000-C000-000000000046}"
[HKEY_CLASSES_ROOT\Interface\{2933BF80-7B36-11D2-B20E-00C04F983E60}\TypeLib]
"Version"="6.0"
@="{F5078F18-C551-11D3-89B9-0000F81FE221}"
如果我从IXMLNode中查找已注册的Typelib,我会找到这个条目:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\TypeLib\{F5078F18-C551-11D3-89B9-0000F81FE221}]
[HKEY_CLASSES_ROOT\TypeLib\{F5078F18-C551-11D3-89B9-0000F81FE221}\3.0]
@="Microsoft XML, v3.0"
[HKEY_CLASSES_ROOT\TypeLib\{F5078F18-C551-11D3-89B9-0000F81FE221}\3.0\0]
[HKEY_CLASSES_ROOT\TypeLib\{F5078F18-C551-11D3-89B9-0000F81FE221}\3.0\0\win32]
@="C:\\Windows\\system32\msxml3.dll"
[HKEY_CLASSES_ROOT\TypeLib\{F5078F18-C551-11D3-89B9-0000F81FE221}\3.0\FLAGS]
@="0"
[HKEY_CLASSES_ROOT\TypeLib\{F5078F18-C551-11D3-89B9-0000F81FE221}\4.0]
@="Microsoft XML, v4.0"
[HKEY_CLASSES_ROOT\TypeLib\{F5078F18-C551-11D3-89B9-0000F81FE221}\4.0\0]
[HKEY_CLASSES_ROOT\TypeLib\{F5078F18-C551-11D3-89B9-0000F81FE221}\4.0\0\win32]
@="C:\\Windows\\system32\\msxml4.dll"
[HKEY_CLASSES_ROOT\TypeLib\{F5078F18-C551-11D3-89B9-0000F81FE221}\4.0\FLAGS]
@="0"
[HKEY_CLASSES_ROOT\TypeLib\{F5078F18-C551-11D3-89B9-0000F81FE221}\4.0\HELPDIR]
@=""
[HKEY_CLASSES_ROOT\TypeLib\{F5078F18-C551-11D3-89B9-0000F81FE221}\6.0]
@="Microsoft XML, v6.0"
[HKEY_CLASSES_ROOT\TypeLib\{F5078F18-C551-11D3-89B9-0000F81FE221}\6.0\0]
[HKEY_CLASSES_ROOT\TypeLib\{F5078F18-C551-11D3-89B9-0000F81FE221}\6.0\0\win32]
@="C:\\Windows\\system32\\msxml6.dll"
[HKEY_CLASSES_ROOT\TypeLib\{F5078F18-C551-11D3-89B9-0000F81FE221}\6.0\FLAGS]
@="0"
功能看起来像这样:
CString ClassA::GetNodeText( IXMLDOMNodePtr spNode, LPCTSTR pszXPath )
{
ASSERT( ::AfxIsValidString( pszXPath ) );
if( spNode )
spNode = spNode->selectSingleNode( pszXPath );
return ( spNode != NULL ) ? (LPCWSTR) spNode->text : NULL;
}
似乎函数selectSingleNode(msxml3.dll的函数)内部包含了与selectSingleNode(msxml6.dll的函数)相同的COM-Object(IXMLDOMNode)。
不是吗?或者我错了?它如何与函数一起使用?