- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have an older program written in fortran, and would like to run the program, send the input and output text to winforms controls.
New to this Visual Fortran but used Visual Studio for years; i couldnt figure out how to generate a GUI; tried adding an HTML page hoping to at least be able to use a web page if there are no standard graphical tools available.
Right now the older fortran code will open a command window, print text, wait for user input like select an item, 1, 2, 3, etc...
Can I create a C# winform and have the Intel compiler package the fortran code somehow?
thanks
New to this Visual Fortran but used Visual Studio for years; i couldnt figure out how to generate a GUI; tried adding an HTML page hoping to at least be able to use a web page if there are no standard graphical tools available.
Right now the older fortran code will open a command window, print text, wait for user input like select an item, 1, 2, 3, etc...
Can I create a C# winform and have the Intel compiler package the fortran code somehow?
thanks
Link Copied
17 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There are many options, though not exactly as you are proposing. What some people do is write the GUI part in C++ or C# and call the Fortran code as an unmanaged DLL. There are more advanced options using the COM Server Wizard, but I don't recommend that to you.
If all you want to do is add a GUI, that is pretty easy. You can start by changing the project property Fortran > Libraries > Use Runtime Library to "QuickWin". This will give you a single window with a menu bar - the window is your input and output. You can add more menus, dialogs, graphics and more.
Another popular choice, but more work, is to restructure the program as a "Windows Application" where you make Win32 calls and manage the windows, dialogs and messages yourself.
I'll let some of the forum users, who have written extensive applications, give you further advice. You may want to explore the samples provided - just unzip each set to a writable folder (say on your desktop), open the .sln file and build. If there is a README, read it first. Look at the QuickWin, Dialog and Win32 samples.
If all you want to do is add a GUI, that is pretty easy. You can start by changing the project property Fortran > Libraries > Use Runtime Library to "QuickWin". This will give you a single window with a menu bar - the window is your input and output. You can add more menus, dialogs, graphics and more.
Another popular choice, but more work, is to restructure the program as a "Windows Application" where you make Win32 calls and manage the windows, dialogs and messages yourself.
I'll let some of the forum users, who have written extensive applications, give you further advice. You may want to explore the samples provided - just unzip each set to a writable folder (say on your desktop), open the .sln file and build. If there is a README, read it first. Look at the QuickWin, Dialog and Win32 samples.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve, thanks so much for this answer. I will try the easy choice first. unmanaged dll sounds like a fun challenge, maybe save that for a rainy day.
I did not see any attached samples?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ok, i tried changing the properties, fortran, libraries, runtime Library, "QuickWin (/libs:qwin)" and ran, but it got this odd error message
ok i guess i cant get the screen shot to stick; it launched the console window then has a popup dialog box full of errors, title is: Intel Visual Fortran run time error
fortl:severe(157)Program Exception: access violation
Image PC Runtime Line Source
myfile.exe 00486455 Unknown Unknown Unknown
repeats like this for 15 lines or so
there is no design ui that i could find; do i need to create a new project?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oh, I forgot another thing that needs changing, but yes, just create a new QuickWin project and add your sources to it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ok tried this, but where is the design view?
i was not able to find the basic window with a menu bar anywhere
thanks
Brad
i was not able to find the basic window with a menu bar anywhere
thanks
Brad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is no Design View. Perhaps you should read the "using QuickWin" section of the documentation. QuickWin gives your traditional console application a "Windows look and feel" but it is not like a forms designer. Make sure you did not pick the "standard graphics" option as that is DOS-like with no menu.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes Ive read the documentation, but thought i was missing it. I did Fortran back in the 1980s and even did punched cards; run a batch and get a printout from 2 foot wide paper...
Nowadays i just expected it would be streamlined. I tried every project type found.
Can an html web page be used as a front end to make the user interface for a Fortran program in QuickWin?
In my program i did find this:
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_WinApp3_DIALOG DIALOGEX 40, 40, 185, 92
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "Dialog Title"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "Apply",IDM_APPLY,128,7,50,14
PUSHBUTTON "Exit",IDM_EXIT,128,23,50,14
LTEXT "TODO: Place dialog controls here.",IDC_STATIC,5,34,113,8
END
So maybe what I should do is try it the way its done now and get used to that first...
But i would like the option to create a quick html page that controls a fortran routine, am searching for this
Nowadays i just expected it would be streamlined. I tried every project type found.
Can an html web page be used as a front end to make the user interface for a Fortran program in QuickWin?
In my program i did find this:
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_WinApp3_DIALOG DIALOGEX 40, 40, 185, 92
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "Dialog Title"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "Apply",IDM_APPLY,128,7,50,14
PUSHBUTTON "Exit",IDM_EXIT,128,23,50,14
LTEXT "TODO: Place dialog controls here.",IDC_STATIC,5,34,113,8
END
So maybe what I should do is try it the way its done now and get used to that first...
But i would like the option to create a quick html page that controls a fortran routine, am searching for this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So in an Intel Visual Fortran Windowing Application, i go to the handler for the button click event and try to make it do something on the new html page that was added.
SUBROUTINE WinApp3Apply( dlg, id, callbacktype )
!DEC$ ATTRIBUTES DEFAULT :: WinApp3Apply
use iflogm
use ifcom
use ifauto
implicit none
type (dialog) dlg
integer id, callbacktype
if (callbacktype == dlg_clicked) then
WinApp3.HTMLPage1.TextBox1.text = "clicked" (its WinApp3 and the page is HTMLPage1 with
a few controls on it. Gets Error #6456)
! TO DO; Add your APPLY logic here
endif
END SUBROUTINE WinApp3Apply
Trying to connect together the webpage and fortran code. Ive got alot of fortran programs that need to be put into regular windows UI type apps. Having the basic windows controls is ok, but i want the WPF looking UI with glass buttons
SUBROUTINE WinApp3Apply( dlg, id, callbacktype )
!DEC$ ATTRIBUTES DEFAULT :: WinApp3Apply
use iflogm
use ifcom
use ifauto
implicit none
type (dialog) dlg
integer id, callbacktype
if (callbacktype == dlg_clicked) then
WinApp3.HTMLPage1.TextBox1.text = "clicked" (its WinApp3 and the page is HTMLPage1 with
a few controls on it. Gets Error #6456)
! TO DO; Add your APPLY logic here
endif
END SUBROUTINE WinApp3Apply
Trying to connect together the webpage and fortran code. Ive got alot of fortran programs that need to be put into regular windows UI type apps. Having the basic windows controls is ok, but i want the WPF looking UI with glass buttons
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, you can't do it like that. There is no "forms designer" or HTML page interaction in Fortran.
I think I should let some of the users who write applications try to explain the options because I don't seem to be doing a good job of it.
I think I should let some of the users who write applications try to explain the options because I don't seem to be doing a good job of it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok trying the example for making a Fortran .dll COM server, adding machine project; Using the help page in vs2008, it found an example: ms-help://MS.VSCC.v90/intel.forprodocs/intel.fprocompilerdocs/main_for/bldaps_for/win/bldaps_create_fortcomsrv.htm
i get all the way thru and it gets 1 error saying REGSVR32 failed. Try it manually and it sure fails, 80040214 and PRJ0019 were 2 of the error codes.
Using Vista 64b ultimate. download Dependency Walker, run the addingmachine.dll and it says this:
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: Modules with different CPU types were found.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
and it shows a missing file, GPSVC.DLL Error opening file. The system cannot find the file specified.
Could be that somehow parts of the project are 64 and some x86? will try to fix that first and hope
i get all the way thru and it gets 1 error saying REGSVR32 failed. Try it manually and it sure fails, 80040214 and PRJ0019 were 2 of the error codes.
Using Vista 64b ultimate. download Dependency Walker, run the addingmachine.dll and it says this:
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: Modules with different CPU types were found.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
and it shows a missing file, GPSVC.DLL Error opening file. The system cannot find the file specified.
Could be that somehow parts of the project are 64 and some x86? will try to fix that first and hope
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What form is your input in and what form is your output that you want to display?
It is quite possible to create a GUI using IVF, Visual Basic, C# or whetever, and do your number crunching or other processing in an existing Fortran engine if the latter is converted to a Dynamic-link library (DLl) called from your GUI code (there are several examples of mixed-language programming included with the IVF installation.) Transferring numbers back and forth tends to be a little easier than exchanging character strings.
If you want graphics output, then I think it would be best to do all your GUI and processing in Fortran (using QuickWin for starters if you have no experience using the Windows API drawing functions).
Otherwise, there are simple examples available in IVF of dialog-based GUI applications that demonstrate the use of edit boxes for entering and displaying data which you would be wise to examine to see how it's done.
It is quite possible to create a GUI using IVF, Visual Basic, C# or whetever, and do your number crunching or other processing in an existing Fortran engine if the latter is converted to a Dynamic-link library (DLl) called from your GUI code (there are several examples of mixed-language programming included with the IVF installation.) Transferring numbers back and forth tends to be a little easier than exchanging character strings.
If you want graphics output, then I think it would be best to do all your GUI and processing in Fortran (using QuickWin for starters if you have no experience using the Windows API drawing functions).
Otherwise, there are simple examples available in IVF of dialog-based GUI applications that demonstrate the use of edit boxes for entering and displaying data which you would be wise to examine to see how it's done.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Some of the programs will be taking a file as input, others will be just 1 or more text input boxes; Id really like to have some way to stream live samples from a sensor(s) as a final working program
The outputs will always be a file, some of these will also produce graph output like FFT's or similar, doesnt have to be fancy, just have to be able to see the graph
Yes I started the DLL approach yesterday, did an example from an article but when building it errors out saying regsvr32 failed; tried manually and still fails. in the debug code version of the demo/calculator i run Dependency walker and it complains its not a valid dll; in release it finds both x86 and 64b entries; and it cannot find a file.
Yes for some of the Fortran modules Ive got i could get by with doing basic windowing graphics, manually drawing the buttons/boxes; Clearly the approach to take is to make the Fortran dll and have a C# gui, this should work fine.
the Fortran dll was simple, not sure why it wasnt compatible with regsvr32. Goal now is to create a Fortran dll that will register;
Im not finding samples of anything, in the first reply here it said run the attached samples? i couldnt find any, nor have i found any by searching. the only one i have found was an article (addingmachine) that had me create the dll project and modify it based on reading the article; thats fine, its more of a learning process than just running a working solution;
The outputs will always be a file, some of these will also produce graph output like FFT's or similar, doesnt have to be fancy, just have to be able to see the graph
Yes I started the DLL approach yesterday, did an example from an article but when building it errors out saying regsvr32 failed; tried manually and still fails. in the debug code version of the demo/calculator i run Dependency walker and it complains its not a valid dll; in release it finds both x86 and 64b entries; and it cannot find a file.
Yes for some of the Fortran modules Ive got i could get by with doing basic windowing graphics, manually drawing the buttons/boxes; Clearly the approach to take is to make the Fortran dll and have a C# gui, this should work fine.
the Fortran dll was simple, not sure why it wasnt compatible with regsvr32. Goal now is to create a Fortran dll that will register;
Im not finding samples of anything, in the first reply here it said run the attached samples? i couldnt find any, nor have i found any by searching. the only one i have found was an article (addingmachine) that had me create the dll project and modify it based on reading the article; thats fine, its more of a learning process than just running a working solution;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should not need to register any DLLs. Are you trying to build a COM Server project type?
Ignore the Dependency Walker complaints - they are due to the way that PATH is set up on x64 systems and it doesn't understand that Windows skips over DLLs that are the "wrong" architecture.
The product has samples installed along with the compiler.
Ignore the Dependency Walker complaints - they are due to the way that PATH is set up on x64 systems and it doesn't understand that Windows skips over DLLs that are the "wrong" architecture.
The product has samples installed along with the compiler.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes trying to make all Fortran modules into COM objects that the C# app can use.
I just tried the build based on following the example they posted, when it got past linking it had the error with regsvr32 on this vista machine;
On another pc running XP, i created a generic dll with methods and variables and dummy functions, and that registered fine on that pc.
...wait I was running COM server when I should be trying just the library/dll ?
I just tried the build based on following the example they posted, when it got past linking it had the error with regsvr32 on this vista machine;
On another pc running XP, i created a generic dll with methods and variables and dummy functions, and that registered fine on that pc.
...wait I was running COM server when I should be trying just the library/dll ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I suggest just making a regular DLL and use the C# way of calling an unmanaged DLL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Fellow Programmer:
There is a most excellent book written on CV Fortran, by an Australian, whose name escapes me as I am at work and the book is on Amazon, get the downloads.
JMN
There is a most excellent book written on CV Fortran, by an Australian, whose name escapes me as I am at work and the book is on Amazon, get the downloads.
JMN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That would be Compaq Visual Fortran: A Guide to Creating Windows Applications by Norman Lawrence. Old by now but nearly all of it applies to Intel Visual Fortran.
You might also look at forum contributor Jugoslav Dujic's xeffort library.
You might also look at forum contributor Jugoslav Dujic's xeffort library.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page