Get_filtered_file@ works great in small programs that do not have much memory associated with them. I wrote a program to just get the file and return the result via a message. The application it was conversing with was called 'EasyView' in my case. This would need to be changed.
winapp
Program File_select
include <windows.ins>
CHARACTER*256 curdir_use,file_in,reply
character*120 FILTERNAMES(3), FILTERSPECS(3),file_type
LOGICAL L,next
CHARACTER*256 filter,defpath
mustexist = 1
call command_line(file_in)
c print *,'File_in before call:',trim(file_in),'|'
c print *,trim(curdir_use)
c print *,'Filename before call:',trim(DB_def_name_in),'|'
c ipos_bslash = index(DB_def_name_in,'',back=.true.)
c if(ipos_bslash .gt. 0)then
c file_in = DB_def_name_in(ipos_bslash+1:)
c else
c file_in = DB_def_name_in
c endif
mode = 0
if(file_in(1:1) .eq. '1')then
nfilter = 3
FILTERNAMES(1) = 'Standard Database files'
FILTERSPECS(1) = '*.dbd'
FILTERNAMES(2) = 'Mapping Database files'
FILTERSPECS(2) = '*.dbm'
FILTERNAMES(3) = 'All Database files'
FILTERSPECS(3) = '*.db*'
file_type = 'Open database'
mode = 1
elseif(file_in(1:1) .eq. '2')then
nfilter = 1
FILTERNAMES(1) = 'Mapping Database files'
FILTERSPECS(1) = '*.dbm'
file_type = 'Open mapping file'
mode = 1
elseif(file_in(1:1) .eq. '3')then
nfilter = 1
FILTERNAMES(1) = 'Program files'
FILTERSPECS(1) = '*.prg'
file_type = 'Execute Program File'
mode = 1
elseif(file_in(1:1) .eq. '4')then
nfilter = 1
FILTERNAMES(1) = 'Program files'
FILTERSPECS(1) = '*.prg'
file_type = 'Interpret Program File'
mode = 1
elseif(file_in(1:1) .eq. 'A')then
c filter = 'Text files'//char(0)//'*.txt'//char(0)
c & //'All files'//char(0)//'*.*'//char(0)//char(0)
c curdir_use = curdir@()
file_type = file_in(2:)
defpath = char(0) !Gives the current working directory
mode = 2
endif
c print *,'Path :',trim(curdir@())
c print *,'Program :',trim(CMPROGNM@())
c call set_open_dialog_path@(curdir_use)
c curdir_use = trim(curdir_use)
if(mode .eq. 1)then
curdir_use = file_in(2:)
file_in=curdir_use
call GET_FILTERED_FILE@(trim(file_type),
& file_in, curdir_use,
& FILTERNAMES, FILTERSPECS, nfilter, mustexist )
i=send_text_message@('EasyView',file_in,reply)
elseif(mode .eq. 2)then
i=send_text_message@('EasyView','#',filter)
c print *,trim(filter)
c substitute vertical bar characters in the file type for char(0)
call translate_specific_chars(filter,'|',char(0))
L = .TRUE.
next = .FALSE.
do while(L)
file_in = char(0)
L=GET_MULTIPLE_FILENAMES@(0,file_type,
& file_in,256,
& filter,defpath,next)
next = .TRUE.
IF(L)then
i=send_text_message@('EasyView',file_in,reply)
c PRINT*, trim(file_in)
endif
END DO