I need to open three different files in a Windows program I'm writing, using WINAPP and including <windows.ins> on a WinXP system. It is a fixed-format FORTRAN program file called PARTSPROG.for .
Using an example from the HELP file, I'm able to open all three successfully. But a lot of windows and mouse clicks are involved for each one, and it gets tedious. I've listed the present code at the bottom of this post. Is there a way I can streamline this?
Presently when I run the program:
- A small window appears with the title 'Select Parts List' and one menu heading, 'File'.
- I click on 'File', and one subheading appears, 'Open'.
- I click on 'Open', and the usual Windows file-selection window appears, letting me navigate thru paths, select the file, and click the OPEN button.
- When I click that OPEN button, the Windows file-selection window disappears, as expected. But the small window with the 'Select Parts List' title is still there.
- If I then click on the X at the upper right corner of this small window, the small window vanishes, and the program moves on the the next section, which uses similar code to open the next file I need.
That works, but is tedious, and there's a risk that I won't realize that after I click the OPEN button and the file-selection window disappears, the small window I see is still for the file I just opened. I might click on its File manuagain, and then on its Open menu, and re-open the same file I just opened, which I don't want to do.
What I'd rather see the program do, using three similar sections of FTN95 code to open three different files, is:
When I start the program, the usual Windows file-selection window appears immediately, with the title 'Select Parts List'.
I navigate thru the paths, click on the file I want, and click the OPEN button. The file-selection window disappears.
A new File-selection window appears (I might put it in a different location on the screen, or with a different color) with the title 'Now select the 2nd file'.
That lets me navigate to the second file, click on it, and click the OPEN button. That file-selection window disappears.
A third file-selection window appears to let me open the third file, etc.
Is there a way I can get my program to operate in a streamlined way like that?
The code I'm presently using is:
PROGRAM MYPARTS
WINAPP
include <windows.ins>
CHARACTER*250 ABPartsListNm,filenm
COMMON/FileNames/filenm
EXTERNAL getfilenm
.
.
filenm=''
i=winio@('%ca[&Select Parts List]&')
i=winio@('%mn[&File[&Open]]','FILE_OPENR',filenm,getfilenm)
ABPartsListNm=filenm
OPEN(3,FILE=ABPartsListNm,ACTION='READ')
.
.
<two more sections of similar code with different filenames> . . STOP END C INTEGER FUNCTION getfilenm() CHARACTER*250 filenm COMMON/FileNames/filenm i=winio@('%ws %`bt[OK]',filenm) getfilenm=1 END