FindFirst-FindNext

FindFirst-FindNext

Postby Slowdown » Sun Oct 13, 2013 2:35 pm

I'm troubled.
Code:
Code: Select all
Public Sub FindDirs(SearchPath As String)
  Dim AllDirectorys As Strings = Dir.FindFile(SearchPath & "/", "*", "System;Hidden;AllDirs")
  For Each Directory As String in AllDirectorys
    If Dir.IsDir(Directory) = True Then
      ListBox1.Append(Directory)
      DoEvents()
      SourceDirLab.Caption = Str(ListBox1.Length())
      DoEvents()     
      FindNextDirs(Directory)
    End If
  Next
End Sub

Public Sub FindNextDirs(SearchPath As String)
  Dim AllDirectorys As Strings = Dir.RecursiveFindFile(SearchPath & "/", "*", "System;Hidden;AllDirs") 
 
  For Each Directory As String in AllDirectorys
    If Dir.IsDir(Directory) = True Then
      ListBox1.Append(Directory)
      DoEvents()
      SourceDirLab.Caption = Str(ListBox1.Length())
      DoEvents()
    End If
  Next
End Sub

Calling it,
Code: Select all
FindDirs("C:/Windows")

9 out of 10 runs KBasic will report,
Unknow Exception.png
Unknow Exception.png (11 KiB) Viewed 241 times

Deleting the Cache does not help.
In my opinion it works or it doesn't, but not sometime it does and sometime it doesn't :cry:
diskus.gif
diskus.gif (14.66 KiB) Viewed 241 times
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 465
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Re: FindFirst-FindNext

Postby Henning » Sun Oct 13, 2013 5:41 pm

Hhmmmm...

Created a new project, and copied your code. Changed the FormName to fit.

It works every time as expected, 745 entries in the ListBox...

Code: Select all
'Sub Form_OnOpen()
'  ListBox1.RemoveAll
'  FindDirs("C:/Windows")
'End Sub
'

Public Sub FindDirs(SearchPath As String)
  Dim AllDirectorys As Strings = Dir.FindFile(SearchPath & "/", "*", "System;Hidden;AllDirs")
  For Each Directory As String in AllDirectorys
    If Dir.IsDir(Directory) = True Then
      ListBox1.Append(Directory)
      DoEvents()
      frmMain.Caption = Str(ListBox1.Length())
      DoEvents()     
      FindNextDirs(Directory)
    End If
  Next
End Sub

Public Sub FindNextDirs(SearchPath As String)
  Dim AllDirectorys As Strings = Dir.RecursiveFindFile(SearchPath & "/", "*", "System;Hidden;AllDirs") 
 
  For Each Directory As String in AllDirectorys
    If Dir.IsDir(Directory) = True Then
      ListBox1.Append(Directory)
      DoEvents()
      frmMain.Caption = Str(ListBox1.Length())
      DoEvents()
    End If
  Next
End Sub


Private Sub CommandButton1_OnEvent()
  ListBox1.RemoveAll
  FindDirs("C:/Windows")
  frmMain.Caption = Str(ListBox1.Length()) & "   DONE!"
End Sub



/Henning
Henning
 
Posts: 523
Joined: Fri Aug 13, 2010 6:29 pm

Re: FindFirst-FindNext

Postby Slowdown » Sun Oct 13, 2013 7:00 pm

It's frustrating me.
Certainly because it's code i have used in the past and it worked without problems.
I have started a few day's ago and the problems started, stripped all the code till the code i listed
and keep the same problems.
I have directory's with more than 20k entry's and one moment it runs fine and the second try bingo again KBasic unknow exception.
Take a much smaller directory and the same problem.
When ported the code to Q7Basic i can easily use FindDirs("C:/") it runs without problems every time.
Use the latest version of KB (5 okt 2010).
i'm out of options.
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 465
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Re: FindFirst-FindNext

Postby Slowdown » Mon Oct 14, 2013 1:18 pm

Because i was out of options i did install a fresh copy of Windows XP.
sadly no luck, it seems that at the first glance it solved my problems but when reading a somewhat bigger directory
i got the same error.
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 465
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Re: FindFirst-FindNext

Postby Henning » Mon Oct 14, 2013 6:39 pm

Thinking loud...

Could it be somthing with VBox, as I understand it youre running XP in a VM....

My kbrun.exe is dated 2010-10-21

/Henning
Henning
 
Posts: 523
Joined: Fri Aug 13, 2010 6:29 pm

Re: FindFirst-FindNext

Postby Slowdown » Tue Oct 15, 2013 5:25 am

You could have a valid point Henning,

I don't have Windows hardware anymore started in 2006 with the mac.
But do have older realeses of Virtualbox, will try and let you know.
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 465
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Re: FindFirst-FindNext

Postby Slowdown » Tue Oct 15, 2013 9:48 am

Did try some older releases of VB but still no luck.
I'll let it rest.
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 465
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Re: FindFirst-FindNext

Postby Slowdown » Tue Oct 15, 2013 1:03 pm

I didn't let it rest, tried it on Windows 7
I now have reclaimed 25 GB 8-)
The first 300 directory's where no problem but after the aprox. 300 directory's
the directory's where read in by 1 in each 3 or 4 minutes :roll:
Now i'll let it rest.
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 465
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Re: FindFirst-FindNext

Postby Henning » Tue Oct 15, 2013 8:57 pm

How much RAM have you allocated for XP in the VM?

745 entries in my app in < 5 sec.

/Henning
Henning
 
Posts: 523
Joined: Fri Aug 13, 2010 6:29 pm

Re: FindFirst-FindNext

Postby Slowdown » Wed Oct 16, 2013 10:20 am

In VB i have 2GB allocated for XP.
The speed isn't a problem with XP that problem i encountered with Windows 7 (64 bit)
If it's not crashing i can read 40K directory's in 11 seconds 8-)
I'm now testing nearly the same code in Q7B, so far no crashing.
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 465
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Next

Return to Legacy: KBasic related

Who is online

Users browsing this forum: No registered users and 1 guest