Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28595 Discussions

Handling automation or COM events (?) in Visual Fortran application

jmcgowan11
Beginner
325 Views

Hello,

I have an Intel Visual Fortran 10.1 application that I am working on. I have used the Fortran Module Wizard to create a Fortran wrapper for a COM server...let's call is xxx.dll

I can invoke the COM routines in xxx.dll fine. However, the xxx.dll generates "notfication events" that appear to be automation events of some kind.

I need my client (a windows SDI application at the moment) to process the "notfication events" from xxx.dll. I need to duplicate the functionality of a C++ MFC example that appears to use an MFC dispatch map to handle automation events and register a callback function to handle the events. Is there a way to do this or something similar or equivalent in Intel Visual Fortran.

Sincerely,

John McGowan

0 Kudos
2 Replies
John_B__Walter
Beginner
325 Views
Quoting - jmcgowan11

Hello,

I have an Intel Visual Fortran 10.1 application that I am working on. I have used the Fortran Module Wizard to create a Fortran wrapper for a COM server...let's call is xxx.dll

I can invoke the COM routines in xxx.dll fine. However, the xxx.dll generates "notfication events" that appear to be automation events of some kind.

I need my client (a windows SDI application at the moment) to process the "notfication events" from xxx.dll. I need to duplicate the functionality of a C++ MFC example that appears to use an MFC dispatch map to handle automation events and register a callback function to handle the events. Is there a way to do this or something similar or equivalent in Intel Visual Fortran.

Sincerely,

John McGowan

0 Kudos
John_B__Walter
Beginner
325 Views
Quoting - jmcgowan11

Hello,

I have an Intel Visual Fortran 10.1 application that I am working on. I have used the Fortran Module Wizard to create a Fortran wrapper for a COM server...let's call is xxx.dll

I can invoke the COM routines in xxx.dll fine. However, the xxx.dll generates "notfication events" that appear to be automation events of some kind.

I need my client (a windows SDI application at the moment) to process the "notfication events" from xxx.dll. I need to duplicate the functionality of a C++ MFC example that appears to use an MFC dispatch map to handle automation events and register a callback function to handle the events. Is there a way to do this or something similar or equivalent in Intel Visual Fortran.

Sincerely,

John McGowan

Did you get no replies to this? What I've learned about this is that you write your handler routine with the interface called out in the module created by the Fortran Module Wizard, and then you connect it to the COM object, which might be an Active-X Object, using DlgSetCtrlEventHandler. In my example, my Active-X object is housed in a dialog pointed to by DLG, and has an ID of IDC_PIC. The Fortran Module Wizard generated a module which includes an INTERFACE block for the event routine DatRefEv which has a member ID of mID_DatRef and a value defined for the IID, IID_events, which is used for the events. Once you connect your event handler, DatRefEv in this example, to the COM object, you can issue a command to it which will generate a call to your handler at the appropriate time.

As noted, you have to write the event handler, and it needs to have the interface you find in the module for the COM object. This handler routine could be written in any convenient language, even FORTRAN.

retint = DlgSetCtrlEventHandler(DLG,IDC_PIC, DatRefEv, mID_DatRef, IID_events)

0 Kudos
Reply