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

Progress Dialog in Fortran DLL called from C++ GUI

javjav
Beginner
514 Views
I am developing a C++ GUI for a computationally intensive Fortran code. I plan to place the Fortran code in a DLL as it only requires the passing of a string argument. My problem is I'm not sure how to implement a progress dialog in the Fortran DLL that will be compatible with the C++ GUI. Can someone please give me some advice on how to get this done.
0 Kudos
4 Replies
Steven_L_Intel1
Employee
514 Views
See the DIALOGDLLPRGRS sample provided with recent versions of CVF.

Steve
0 Kudos
Jugoslav_Dujic
Valued Contributor II
514 Views
...or myThreadDlg sample.

Jugoslav
0 Kudos
javjav
Beginner
514 Views
Okay, so I took your ThreadDlg example, converted it to a subroutine, put it into a DLL and linked it to my C++ dialog based app. I also included the DllMain function from DLLPRGRS and swapped in DlgInitWithResourceHandle. The program compiles and runs fine, I get the dialog from the C++ main but I don't see the Fortran DLL's dialog. When I debug it the Dlg argument looks reasonable but when I hit DlgModal it just skips right over it and no dialog appears on the screen. Any suggestions would be greatly appreaciated.
0 Kudos
Jugoslav_Dujic
Valued Contributor II
514 Views
Sorry, can't tell you offhand why it fails. What does GetLastError() say? Off the top of my head, I can only think of failure to call InitCommonControls(), required because of progress bar (it loads comctl32.dll and registers window classes; frequently, it is loaded by other dlls so it usually works even without that call, so I tend to forget it ) -- the error message would be "Cannot find window class" in this case.

But anyway, I meant that sample only as illustration of the technique. A better approach will be that you create and manage the dialog on C++ side, and leave only number crunching in Fortran; for updating, provide a callback function, passed through Dll's arg-list. See here for a relevant info.

Jugoslav
0 Kudos
Reply