Progress Dialog in Fortran DLL called from C++ GUI

Progress Dialog in Fortran DLL called from C++ GUI

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.

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

See the DIALOGDLLPRGRS sample provided with recent versions of CVF.


Retired 12/31/2016

...or myThreadDlg sample.


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.

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.


Leave a Comment

Please sign in to add a comment. Not a member? Join today