Silverfrost Forums

Welcome to our forums

get filtered file

13 Aug 2015 2:01 #16721

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

14 Aug 2015 9:09 #16723

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

14 Aug 2015 4:13 #16727

Quoted from JohnCampbell

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.

15 Aug 2015 9:40 #16736

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.

15 Aug 2015 10:25 #16737

I tried to download this and my virus protection reported it as infected with

Win32:Evo-gen

Regards Ian

17 Aug 2015 12:17 #16745

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

17 Aug 2015 1:00 #16746

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

17 Aug 2015 3:49 #16747

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.

18 Aug 2015 11:27 #16750

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
18 Aug 2015 11:29 #16751

continued

        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
18 Aug 2015 11:42 #16752

In the main program where I wanted to open a file I have the callback used to open the file as:

      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
18 Aug 2015 11:46 #16753

Here is a fragment of the message handling call back

      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...

      i=winio@('%nc[EasyView]%rm&',message_cb)

I hope this helps. Ian

Please login to reply.