Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference
A newer version of this document is available. Customers should click here to go to the newest version.
Visible to Intel only — GUID: GUID-FA2A4135-2391-4257-A0D1-509067746093
Visible to Intel only — GUID: GUID-FA2A4135-2391-4257-A0D1-509067746093
COMInitialize
COM Subroutine: Initializes the COM library. This routine is only available for Windows.
USE IFCOM
CALL COMInitialize (status)
status |
The status of the operation. It can be any status returned by OleInitialize. Must be of type INTEGER(4). |
You must use this routine to initialize the COM library before calling any other COM or AUTO routine.
Consider the following:
program COMInitExample
use ifwin
use ifcom
use ifauto
implicit none
! Variables
integer(4) word_app
integer(4) status
integer(INT_PTR_KIND()) invoke_args
call COMInitialize(status)
! Call GetActiveObject to get a reference to a running MS WORD application
call COMGetActiveObjectByProgID("Word.Application", word_app, status)
if (status >= 0) then
! Print the active document
invoke_args = AutoAllocateInvokeArgs()
call AutoAddArg(invoke_args, "Copies", 2)
status = AutoInvoke(word_app, "PrintOut", invoke_args)
call AutoDeallocateInvokeArgs(invoke_args)
! Release the reference
status = COMReleaseObject(word_app)
end if
call COMUninitialize()
end program