PDA

View Full Version : GetSaveFileName


Evan T
06-03-2009, 11:17 PM
I'm trying to convert some of my LF90 programs to LF95.

In using the winapi, I DLL_IMPORT a bunch of functions. Most of them come in fine, but GetSaveFileName and GetOpenFileName both fail. In LF90, I was able to access these functions as

dll_import GetSaveFileNameA,GetOpenFileNameA
INTEGER :: GetSaveFileNameA,GetOpenFileNameA

Any suggestions on the new names? Or what functions I might use to open a File Save or File Open dialog box?

The program has to run in XP.

RobertVanA
06-04-2009, 12:51 PM
Evan,

Did you use the library comdlg32.lib in the linking phase?

Robert

Evan T
06-04-2009, 03:35 PM
That addition fixed both the FileOpen and the PrintDlg problem... and with that I have converted 60,000 lines of code from LF90 to LF95 in 1.5 days.

Very good.

The only surprise I had (an undocumented problem) is that if I pass an optional parameter like

function Open(Name,Action)
..character(*) :: Name
..character(*),Optional :: Action
..open(8,Name,ACTION=Action,IOSTAT=ierr)
end function

fails if Action is not Passed. Even the ierr is not returned. I had to use:

function Open(Name,Action)
..character(*) :: Name
..character(*),Optional :: Action
..if(PRESENT(Action))then
....open(8,Name,ACTION=Action,IOSTAT=ierr)
..else
....open(8,Name,IOSTAT=ierr)
..endif
end function

It seems if it is optional in a library routine, I ought to be able to pass an optional parameter. But with that and the comdlg32.lib It's all done and working.

Thanks again.

I guess my only question remaining is 'How do you know these things???'