注册 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);
}
要求
Header: afxdisp.h