AfxOleRegisterTypeLib

使用 [Windows 系統註冊資料庫中註冊型別程式庫並允許其他注意 OLE 控制項容器所使用的型別程式庫。

BOOL AfxOleRegisterTypeLib(
   HINSTANCE hInstance,
   REFGUID tlid,
   LPCTSTR pszFileName = NULL,
   LPCTSTR pszHelpDir = NULL 
);

參數

  • hInstance
    型別程式庫相關聯的應用程式的執行個體控制代碼。

  • tlid
    型別程式庫的唯一識別碼。

  • 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

請參閱

參考

AfxOleUnregisterTypeLib

AfxOleRegisterControlClass

AfxOleUnregisterClass

概念

MFC 巨集和全域變數