Solved

Can anyone help with details of LoadTypeLib()

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

738 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