|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
stenlou
Joined: 24 Jun 2008 Posts: 30 Location: Germany and Denmark
|
Posted: Thu Aug 13, 2015 3:01 pm Post subject: get filtered file |
|
|
Gents,
I have recently identified aproblem with Get_filtered_file@.....
When I call the routine more than 3 to 4 times, then my program hangs for approx 1 to 2 minutes.
I have never seen this in the past (as I never called the Get_fileterd_file more than once or twice before closing the program.
I am running on Win7 and 64 bit (not what I used in the past). Could there be a DLL problem or ????
I have made an extremely simple program that just call used the Get_filtered_file, get the file name (and do nothing with the file), then does it again and again and then the program Hangs.
Any suggestions?
Regards
Sten |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Fri Aug 14, 2015 10:09 am Post subject: |
|
|
There has been a lot posted on this topic, since Win 7 was introduced.
It could be support for virtual directory structures (libraries) or just a bug in Microsoft support of directories.
There definitely appears to be a memory leakage problem of some form.
Microsoft introduced new directory access information routines at Win 7 which are another possibility.
Reducing the amount of memory your program uses appears to delay these problems occurring.
Enough with the symptoms: I do not know a solution !!
I have not seen a solution published in recent time.
I would look forward to being proved wrong with this summary.
John |
|
Back to top |
|
|
jalih
Joined: 30 Jul 2012 Posts: 196
|
Posted: Fri Aug 14, 2015 5:13 pm Post subject: Re: |
|
|
JohnCampbell wrote: |
Enough with the symptoms: I do not know a solution !!
I have not seen a solution published in recent time.
I would look forward to being proved wrong with this summary.
|
Actually, I have already posted a little FTN95 callable DLL as an example on how to use the new Windows 7 style file dialogs. My DLL is written in MiniBASIC but should translate quite easily to C++.
Download DLL-file with source code and example FTN95 project from here.
MiniBASIC source for the DLL is located inside fd.mba file. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Sat Aug 15, 2015 10:40 am Post subject: |
|
|
My understanding is that Jalih's code is not fundamentally different from what you get in ClearWin+ and the style should be the same.
If it works better than ClearWin+ then I guess that this is because it uses a separate DLL so maybe the memory is managed in a different way.
As I have mentioned elsewhere, 64 bit ClearWin+ provides a different approach to the memory management so may be more robust. |
|
Back to top |
|
|
IanLambley
Joined: 17 Dec 2006 Posts: 490 Location: Sunderland
|
Posted: Sat Aug 15, 2015 11:25 am Post subject: |
|
|
I tried to download this and my virus protection reported it as infected with
Win32:Evo-gen
Regards
Ian |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Mon Aug 17, 2015 1:17 pm Post subject: |
|
|
Paul,
Back when this error appeared, I reduced the memory usage for my graphics program and stopped using get_filtered_file@.
Can you indicate when this file opening approach was updated ?
I shall see if I can reproduce the problems I was having.
Also, memory limitation on 64-bit is not as significant a problem, unless you are using the stack. I try to use ALLOCATE extensively, which overcomes most of these problems.
John |
|
Back to top |
|
|
stenlou
Joined: 24 Jun 2008 Posts: 30 Location: Germany and Denmark
|
Posted: Mon Aug 17, 2015 2:00 pm Post subject: |
|
|
All,
Can someone advise me what the best solution is at the moment for the problems with Get_filtered_file.
Currently, I cannot even save a file, 'pain in the behind'
Sten |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Mon Aug 17, 2015 4:49 pm Post subject: |
|
|
Sten
If you can not do anything then that is suspicious.
Can you post a short program that does nothing except call get_filterered_file@. Maybe there is something wrong with the way that you are calling the routine. |
|
Back to top |
|
|
IanLambley
Joined: 17 Dec 2006 Posts: 490 Location: Sunderland
|
Posted: Tue Aug 18, 2015 12:27 pm Post subject: |
|
|
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.
Code: |
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
|
|
|
Back to top |
|
|
IanLambley
Joined: 17 Dec 2006 Posts: 490 Location: Sunderland
|
Posted: Tue Aug 18, 2015 12:29 pm Post subject: |
|
|
continued
Code: |
i=send_text_message@('EasyView',' ',reply)
endif
c print *,'Filename:',trim(file_in)
end
subroutine translate_specific_chars(text,from_chars,to_chars)
character*(*) text,from_chars,to_chars
c
c translate specific characters from text string
ilen = leng(text)
do 10 i=1,ilen
ipos = index(from_chars,text(i:i))
if(ipos .ne. 0)then
text(i:i) = to_chars(ipos:ipos)
endif
10 continue
return
end
resources
1 24 default.manifest
|
|
|
Back to top |
|
|
IanLambley
Joined: 17 Dec 2006 Posts: 490 Location: Sunderland
|
Posted: Tue Aug 18, 2015 12:42 pm Post subject: |
|
|
In the main program where I wanted to open a file I have the callback used to open the file as:
Code: |
integer*4 igrey_menu,menu_mode
common/menu_stuff/igrey_menu,menu_mode
.
.
.
i=winio@('%mn[~File[Open Database,Exit,|]]&',
& igrey_menu,
& itest_cb1,'EXIT')
.
.
.
.
.
integer*4 function itest_cb1()
include <windows.ins>
integer*4 start_pprocess@
integer*4 igrey_menu,menu_mode
common/menu_stuff/igrey_menu,menu_mode
character*256 DB_def_name_in
common/filenames/DB_def_name_in
itest_cb1 = 1
menu_mode = 1
c print *,'File_in before call:',trim(file_in),'|'
i= start_pprocess@('File_select.exe','1'//trim(DB_def_name_in))
igrey_menu = 0
end
|
|
|
Back to top |
|
|
IanLambley
Joined: 17 Dec 2006 Posts: 490 Location: Sunderland
|
Posted: Tue Aug 18, 2015 12:46 pm Post subject: |
|
|
Here is a fragment of the message handling call back
Code: | integer*4 function message_cb()
CHARACTER*256 file_in
include <windows.ins>
integer*4 igrey_menu,menu_mode
common/menu_stuff/igrey_menu,menu_mode
character*256 header,file_type,work
common/multifile_text/header,file_type
common/multifile_numb/ilist,itrim
message_cb = 2
file_in = clearwin_string@('message_text')
if(menu_mode .eq. 10 .and. file_in .eq. '#')then
call reply_to_text_message@(file_type)
return
else
call reply_to_text_message@('Thanks')
endif
c print *,'returned file',trim(file_in)
c print *,'menu_mode',menu_mode
if(menu_mode .eq. 1)then
if(file_in .ne. ' ')then
DB_def_name_in = file_in
i = iuse_db()
endif
igrey_menu = 1
elseif(menu_mode .eq. 2)then
if(file_in .ne. ' ')then
map_file = file_in
i = iread_mapping()
endif
igrey_menu = 1
elseif......
|
it also needs som window updates to grey and ungrey various bits and pieces.
The message_cb had already been installed as the handler in main program with...
Code: | i=winio@('%nc[EasyView]%rm&',message_cb)
|
I hope this helps.
Ian |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|