Solved

Can anyone help with details of LoadTypeLib()

Posted on 1998-03-11
4
890 Views
Last Modified: 2013-12-03
Can anyone help with documentation on the syntax, arguments, etc of LoadTypeLib() or LoadTypeLibEx() Win API calls.
0
Comment
Question by:PeterA081597
  • 2
  • 2
4 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 1411911
If you mean you just want the documentation, then

LoadTypeLib <Picture>

HRESULT LoadTypeLib(


OLECHAR FAR* szFile,



ITypeLib FAR* FAR* pptlib



);



Loads and registers a type library.

Parameters

szFile

Contains the name of the file from which LoadTypeLib should attempt to load a type library.

pptlib

On return, contains a pointer to a pointer to the loaded type library.

Return Value

The return value obtained from the returned HRESULT is one of the following:


Return value



Meaning

S_OK



Success.

E_OUTOFMEMORY



Out of memory.

E_INVALIDARG



One or more of the arguments is invalid.

TYPE_E_IOERROR



The function could not write to the file.

TYPE_E_INVALIDSTATE



The type library could not be opened.

TYPE_E_INVDATAREAD



The function could not read from the file.

TYPE_E_UNSUPFORMAT



The type library has an older format.

TYPE_E_UNKNOWNLCID



The LCID could not be found in the OLE-supported DLLs.

TYPE_E_CANTLOADLIBRARY



The type library or DLL could not be loaded.

Other return codes



All FACILITY_STORAGE errors can be returned.



Comments

The function LoadTypeLib loads a type library (usually created with MkTypLib) that is stored in the specified file. If szFile specifies only a file name without any path, LoadTypeLib searches for the file and proceeds as follows:

· If the file is a stand-alone type library implemented by Typelib.dll, the library is loaded directly.

· If the file is a DLL or an executable file, it is loaded. By default, the type library is extracted from the first resource of type ITypeLib. To load a different type of library resource, append an integer index to szFile. For example:

LoadTypeLib("C:\MONTANA\EXE\MFA.EXE\3", pptlib)





This statement loads the type library resource 3 from the file Mfa.exe file.

· If the file is none of the above, the file name is parsed into a moniker (an object that represents a file-based link source), and then bound to the moniker. This approach allows LoadTypeLib to be used on foreign type libraries, including in-memory type libraries. Foreign type libraries cannot reside in a DLL or an executable file. For more information on monikers, see the OLE Programmer's Reference in the Win32 SDK.

If the type library is already loaded, LoadTypeLib increments the type library's reference count and returns a pointer to the type library.

For backward compatibility, LoadTypeLib will register the type library if the path is not specified in the szFile parameter. LoadTypeLib will not register the type library if the path of the type library is specified. It is recommended that RegisterTypeLib be used to register a type library.



****************************************************************************


LoadTypeLibEx

HRESULT LoadTypeLibEx(


LPCOLESTR szFile,



REGKIND regkind,



ITYPELIB pptlib



);



Loads a type library and (optionally) registers it in the system registry.

Parameters

szFile

Specification for the type library file.

regkind

Identifies the kind of registration to perform for the type library (DEFAULT, REGISTER, or NONE).

pptlib

Reference to the type library being loaded.

Return Value

The return value obtained from the returned HRESULT is one of the following:


Return value



Meaning

S_OK



Success.

E_OUTOFMEMORY



Out of memory.

E_INVALIDARG



One or more of the arguments is invalid.

TYPE_E_IOERROR



The function could not write to the file.

TYPE_E_REGISTRYACCESS



The system registration database could not be opened.

TYPE_E_INVALIDSTATE



The type library could not be opened.



Comments

Enables programmers to specify whether or not the type library should be loaded.

Example

typedef enum tagREGKIND
{
    REGKIND_DEFAULT,
    REGKIND_REGISTER,
    REGKIND_NONE
} REGKIND;

0
 

Author Comment

by:PeterA081597
ID: 1411912
Thanks, nietod, thats the information I was after.  Whats your reference for this information?
0
 
LVL 22

Accepted Solution

by:
nietod earned 50 total points
ID: 1411913
I just copied it from the Microsoft VC++ on-line documentaion.  A clear copyright violation if there ever was one.  Probably a federal crime too, since the information crossed state boundaries.
0
 

Author Comment

by:PeterA081597
ID: 1411914
- and probably an international crime as I'm in Australia!  Thanks, I'm actually a VB programmer (but not for long) and LoadTypeLib was not in any of the VB Win32 API references.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now