Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fortran Windows Application

Status
Not open for further replies.

otokonohito

Mechanical
Jul 20, 2004
1
I have a console program to do some data processing, but I want to create a Windows GUI version of it. However, I cannot find any resources online. Currently I am using Compaq Visual Fortran.

The program reads in 4 files and writes 2 output files.

I am wondering how I can port the current code directly into a fortran windows application with minimal modifications.

I know that I have to use dfwin library to do this, but i am not sure how to get started
 
Replies continue below

Recommended for you

You could use VB to create the interface.
The purpose of the interface being to create the input files needed to run your Fortran program. The Fortran program can be compiled as a *.dll to be called from your VB interface. Output files can be displayed directly in the VB interface.

How?
In Compaq Visusl Fortran, specify the project type as a Fortran dynamic link library project.
In your fortran code replace the

PROGRAM myProgram
with
SUBROUTINE myProgram(nParam)
!MS$ATTRIBUTES DLLEXPORT :: myProgram

Note:- if required(nParam) can be a number of parameters passed from the VB interface

and replace the final
STOP
with
RETURN

Presumably your existing program reads input files as part of its execution so no changes are needed there. Use you VB application to create the input files to be read by your new myProgram.dll. The output files created by the new dll can be displayed directly in the VB environment if required
Refer to your VB documents for calling and using dll's



 
The easiest way for an all-Fortran solution is to use a library aimed at doing that sort of thing for Fortran. For example, the Winteracter package (from ISS Ltd.) gives you Windows interfacing and a pile more. CVF is one of the supported compilers. A "Winteracter Starter Kit (WiSK) comes with the Lahey Fortran compiler; I don't know what might be available in that form for CVF. Gino Menu is another, I believe.
 
You could also try
It is a Java Interface that works in quite a few languages. It is ok as long as you are not polling: just sit at j_nextaction and wait for the next thing to be clicked. Download the examples in both Fortran 77 and 90 and have a play. It is a very quick way of getting a GUI up as long as you are not after anything sophisticated.
 
Creating a DLL from an existing console app is tedious since you would have to take out any print commands and then link the dll to the gui. I did what you need to do once with a Method of Moments code written with CVF. I created a new windows app and copy-pasted al the routines where it usually said "your code here" Then I took out all my print commands and then just played around with the GUI aspects of it. That part is quite straightforward with the help file included with CVF.
The way I see it is that it is the same amount of work but you end up with one code and not a couple (DLL+GUI)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor