Solved

Can anyone help with details of LoadTypeLib()

Posted on 1998-03-11
4
956 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

632 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