- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 libraryIF (.NOT. DlgInit(IDD_PIC9550fr,DLG)) THEN! FAILED to start Dialog having ActiveX ObjectRETINT = MESSAGEBOXQQ( 'Unable to initlize IDD_PIC9550fr'C, &
trim(PROGNAME),MB$OK)ELSE! initialized dialog containing my ActiveX ObjectIF (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 ! doretlog = TranslateMessage( mesg )
retint = DispatchMessage( mesg )
end ifend doEND IFEND 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?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page