Can anyone help with details of LoadTypeLib()

Can anyone help with documentation on the syntax, arguments, etc of LoadTypeLib() or LoadTypeLibEx() Win API calls.
PeterA081597Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nietodCommented:
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
PeterA081597Author Commented:
Thanks, nietod, thats the information I was after.  Whats your reference for this information?
0
nietodCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PeterA081597Author Commented:
- 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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.