OleInitialize
f90VB Modules
f90VBDefs, f90VBAutomation
Summary
Initializes the COM library on the current thread and identifies the concurrency model as single-thread apartment (STA).
Syntax
| integer(HRESULT_KIND) function OleInitialize | () |
Arguments
This function has no arguments.
Comments
Applications must initialize the COM library before they can call other functions from the f90VBAutomation library. The preferred method to initialize the COM library when using f90VBAutomation is by calling OleInitialize, rather than ComInitialize. OleInitialize internally calls ComInitializeEx with the appropriate concurrency model.
OleInitialize can return any of the following values:
| Return Value | Description | |
| S_OK | The COM library was successfully initialized on this thread. | |
| E_OUTOFMEMORY | COM library was not initialized because of lack of memory. | |
| E_UNEXPECTED | An unexpected error occurred. | |
| S_FALSE | The COM library is already initialized on this thread. | |
| OLE_E_WRONGCOMPOBJ | The versions of COMPOBJ.DLL and OLE2.DLL on your machine are incompatible with each other. | |
| RPC_E_CHANGED_MODE | A previous call to ComInitializeEx specified the concurrency model for this thread as multithread apartment (MTA). | |
Calls to OleInitialize must be paired with calls to OleUninitialize (i.e. your program must issue a call to OleUninitialize for each call to OleInitialize). Calls to ComInitialize and OleInitialize can be nested.
Examples
See examples in Chapter 6 - User Manual.
Related Topics
| For information about: | See: | |
| Uninitializing the COM library | ComUninitialize | |
| Initializing the COM Library | ComInitialize, ComInitializeEx | |
| Uninitializing the OLE library | OleUninitialize | |