问题描述
我正在处理两个基于ATL的COM项目.
I am working with two ATL-based COM projects.
两者都实现DllRegisterServer
只是
STDAPI DllRegisterServer(void)
{
// registers object, typelib and all interfaces in typelib
return _Module.RegisterServer(TRUE);
}
最终打电话给
::RegisterTypeLib(pTypeLib, bstrPath, szDir);
atlbase.h:6516.
in atlbase.h:6516.
但是由于某种原因,此调用使项目之一得以创建
But for some reason this call makes one of the projects create
HKEY_CLASSES_ROOT\TypeLib\<guid>\<version>\0\win64
在Windows 7 32位系统上使用regsvr32.exe注册时
when registered using regsvr32.exe on Windows 7 32 bit.
另一个项目正确创建
HKEY_CLASSES_ROOT\TypeLib\<guid>\<version>\0\win32
.
我应该从哪里开始寻找并解决此问题?
Where should I start looking to find and fix this behavior?
推荐答案
类型库很有可能是针对win64平台的.检查类型库的属性.可以通过 ITypeLib访问它们: :GetLibAttr :
It is strongly possible, that the typelibrary is targeted for the win64 platform.Check the typelibary's attributes. One may access them via ITypeLib::GetLibAttr:
ITypeLib::GetLibAttr(TLIBATTR **ppTLibAttr)
TLIBATTR结构的字段类型为 SYSKIND .它包含一个指示平台的值.
The TLIBATTR structure has a field of type SYSKIND. It contains a value which indicates the platform.
typedef enum tagSYSKIND {
SYS_WIN16 = 0,
SYS_WIN32 = ( SYS_WIN16 + 1 ),
SYS_MAC = ( SYS_WIN32 + 1 ),
SYS_WIN64 = ( SYS_MAC + 1 )
} SYSKIND;
我希望这可以帮助您解决问题
I hope this will help you to solve the problem
这篇关于由什么决定RegisterTypeLib是写入win32还是win64?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!