Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Using COM

ackerson
Beginner
472 Views

I am trying to get more familiar with using COM in fortran. I build a project using the example on page 561 of the Intel Fortran Language Reference. It compiled fine. However, when I run the program nothing happens. I added two print statements for the variable status to determine what is going on. Once after call COMInitialize(status) and once after call COMGetActiveObjectByProgID(...). The print statement was zero(0) both times. I am using visual studio 2005. Any recommendation would be great appreciated.

Thanks,

! Test1.f90

!

! FUNCTIONS:

! Test1 - Entry point of console application.

!

!****************************************************************************

!

! PROGRAM: Test1

!

! PURPOSE: Entry point for the console application.

!

!****************************************************************************

program Test1

use ifwin

use ifcom

use ifauto

implicit none

! Variables

integer(4) word_app

integer(4) status

integer(4) invoke_args

! Body of Test1

call COMInitialize(status)

print *, status

call COMGetActiveObjectByProgID("Word.Application", word_app, status)

print *, status

if(status >= 0)then

invoke_args = AutoAllocateInvokeArgs()

call AutoAddArg(invoke_args, "Copies", 2)

status = AutoInvoke(word_app, "PrintOut", invoke_args)

call AutoDeallocateInvokeArgs(invoke_args)

status = COMReleaseObject(word_app)

endif

call COMUninitialize()

end program Test1

0 Kudos
0 Replies
Reply