Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
MFC
TRY
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

AfxOleRegisterTypeLib 

Registers the type library with the Windows registration database and allows the type library to be used by other containers that are OLE-control aware.


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

Parameters

hInstance

The instance handle of the application associated with the type library.

tlid

The unique ID of the type library.

pszFileName

Points to the optional filename of a localized type library (.TLB) file for the control.

pszHelpDir

The name of the directory where the help file for the type library can be found. If NULL, the help file is assumed to be in the same directory as the type library itself.

Nonzero if the type library was registered; otherwise 0.

This function updates the registry with the type library name and its location on the system.

const GUID CDECL BASED_CODE _tlid = { 0x43bd9e45, 0x328f, 0x11d0,
      { 0xa6, 0xb9, 0x0, 0xaa, 0x0, 0xa7, 0xf, 0xc2 } };

// Registers type library and the interfaces
// in it, afxctl.h needs to be included
if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid))
  return ResultFromScode(SELFREG_E_TYPELIB);


// proj.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("proj.tlb"), NULL))
   return ResultFromScode(SELFREG_E_TYPELIB);

Community Additions

ADD
Show:
© 2015 Microsoft