I'm trying to replace some C++ bridge code that opens a file dialog using an .exe and I'm calling the code below but it is crashing reliably.
This is in 64 bit.
If I add CALL CLEARWIN_OPTION@('alt_open_save') then I can get it working.
Is this still the recommended way to open a common dialog box natively from SilverFrost Fortran or am I missing something?
It seems very unreliable without the extra option which is not obvious.
integer function select_file()
use mswin
integer :: res, number_of_filters
logical :: must_exist
character(len=128),dimension (10) :: filter_names, filters
character(len=128) :: file_name,path
character (len=20) :: title
title = 'select_file File';path = 'c:';
file_name = 'fred.f95'
filter_names(1) = 'Text files';filters(1) = '*.txt';
filter_names(2) = 'Batch files'
filters(2) = '*.bat';
filter_names(3) = 'All files';filters(3) = '*.*'
number_of_filters = 3;must_exist = .true.
!CALL CLEARWIN_OPTION@('alt_open_save')
call get_filtered_file@(title, file_name, path,
& filter_names, filters, number_of_filters,must_exist)
res = winio@('%ca[Result]&')
res = winio@('%bg[BTNFACE]&')
res = winio@('You selected file '%ws'%2nl&', file_name)
res = winio@('%cn%bt[OK]')
select_file = 1
end function select_file