Solved

Can anyone help with details of LoadTypeLib()

Posted on 1998-03-11
4
915 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA Import all database objects 12 58
Get a List of Executing Stored Procedures on Sql Server 2008 R2 5 60
Vb.Net Loading Word 11 105
Explain Unit of Work pattern 2 70
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

820 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