AfxOleRegisterTypeLib
注册使用 Windows 注册的数据库类型库并允许类型库是识别的 OLE 其他控件的容器使用。
BOOL AfxOleRegisterTypeLib(
HINSTANCE hInstance,
REFGUID tlid,
LPCTSTR pszFileName = NULL,
LPCTSTR pszHelpDir = NULL
);
参数
hInstance
应用程序的实例句柄与类型库。tlid
类型库的唯一 ID。pszFileName
为本地化的类型库 (.tlb) 的可选文件名的点为控件文件。pszHelpDir
类型库的帮助文件可以找到目录的名称。 如果 NULL,帮助文件假设在与类型库同名。
返回值
非零,则类型库注册;否则 0。
备注
此函数以使用类型库名称和位置的系统注册表。
示例
// Type library guid definition.
const GUID CDECL BASED_CODE _tlid =
{ 0x77E58ED8, 0xA2C0, 0x4C13, { 0xB6, 0xC1, 0xBA, 0xD1, 0x19, 0xAF, 0xE3, 0xF1 } };
// Registers type library and the interfaces
// in it, afxctl.h needs to be included
if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid))
return ResultFromScode(SELFREG_E_TYPELIB);
// CMFCAutomation.tlb should be in the same directory as exe module.
// last param can be null if help file associated w/ tlb is in same dir as .tlb
if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid,
_T("CMFCAutomation.tlb"), NULL))
{
return ResultFromScode(SELFREG_E_TYPELIB);
}
要求
"头部:" afxdisp.h