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.
29280 Discussions

ActiveX objects and ActiveX events in Intel Visual Fortran

John_B__Walter
Beginner
480 Views

It's been a while, but I'm finally back to this project, and have deepened my understanding of COM and ActiveX.

What I was thinking of as callbacks are actually events generated by the ActiveX control.

The COM Wizard captures the calling interface for each of these events, as well as identifying the COM Interface (such as IID__events in my case), and the memberID for each such event defined in the COM Interface. These callbacks are implemented by writting a subroutine which fits the calling interface, and connects it to the ActiveX Object with something like:

CALL COMInitialize(STATUS) ! Initialize COM library

IF (.NOT. DlgInit(IDD_PIC9550fr,DLG)) THEN! FAILED to start Dialog having ActiveX Object

RETINT = MESSAGEBOXQQ( 'Unable to initlize IDD_PIC9550fr'C, &

trim(PROGNAME),MB$OK)

ELSE! initialized dialog containing my ActiveX Object

IF (DlgModeless(DLG)) THEN ! activate dialog (needed to access object)

retlog = DlgGet(DLG,IDC_ActiveX, OBJECT, DLG_IDISPATCH)! Get IDispatch for it

! NOW, connect my handler (ConnectEv) to the Object

retint = DlgSetCtrlEventHandler(DLG,IDC_ActiveX, ConnectEv, memID, IID_events)

do while (.TRUE.)

if ( PeekMessage (mesg, NULL, 0, 0, PM_REMOVE) .and. &

DlgIsDlgMessage(mesg) .EQV. .FALSE. )

then

if (mesg.message == 273) exit ! do

retlog = TranslateMessage( mesg )

retint = DispatchMessage( mesg )

end if

end do

END IF

END IF

It's in that DlgSetCtrlEventHandler that I'm currently having trouble, at least on some machines. Instead of getting my

routine connected, I get a Microsoft C++ dialog box informing me of an Assertion Failed!

Program ...

File: dlglow.cpp

Line: 1189

Expression: SUCCEEDED(hr)

Does anyone have an idea as to what is up with that??

What could be wrong with my routine that would cause this particular assertion failure?

Has one of you used the DlgSetCtrlEventHandler function? Does my routine need

only to have the correct subroutine calling interface, or does it also have to implement

the COM IID_events interface, with QueryInterface and everything else?

0 Kudos
1 Reply
John_B__Walter
Beginner
480 Views

Now I understand what was going on. There was an update to the .ocx and .dll files for the COM interface, but the COM module hadn't been updated.

Once I regenerated the COM module from the updated .dll and .ocx files, the error went away.

My routine only needed to have the correct fortran calling interface, and did not need to support QueryInterface ...

I still need to actually run this on the machine with the equipment, but things are looking very promising.

0 Kudos
Reply