$INCLUDE "RAPIDQ.INC"
DECLARE FUNCTION GetFocus LIB "user32" ALIAS "GetFocus"() AS LONG
DECLARE FUNCTION Setfocus LIB "user32" ALIAS "SetFocus"(hwnd AS LONG) AS LONG
DECLARE SUB GoDirs
DECLARE SUB dirs
DECLARE SUB StopS
DECLARE SUB VisDir(Button%, X%, Y%, Shift%)
DECLARE SUB ChangeDirectory
DEFINT StopS1
DIM Timer1 AS QTIMER
DIM dateR AS STRING
dateR=MID$(DATE$, 4,3)+ MID$(DATE$, 1,3)+MID$(DATE$, 7,4)
DECLARE SUB TimerOver
Timer1.Interval = 400
Timer1.Enabled = 1
Timer1.OnTimer = TimerOver
CREATE Form AS QFORM
CAPTION = "Form1"
Width = 640
Height = 450
Center
OnMouseDown=VisDir
OnMouseMove=VisDir
OnHint=VisDir
CREATE Button1 AS QBUTTON
CAPTION = "GoDirs!"
Left = 455
Top = 8
OnClick=GoDirs
END CREATE
CREATE Button2 AS QBUTTON
CAPTION = "Stop"
Left = 540
Top = 8
OnClick=StopS
END CREATE
CREATE ListView AS QLISTVIEW
Top = 41
Width = 601
Height = 353
CheckBoxes=true
ViewStyle = vsReport
AddColumns "FileName","Size","Date","Time"
Column(0).Width = 400
Column(1).Width = 40
Column(2).Width = 70
Column(3).Width = 70
END CREATE
CREATE Label1 AS QLABEL
top =400
Left = 10
CAPTION = "All hits "
END CREATE
CREATE Edit1 AS QEDIT
Text = "c:\My Documents\"
Left = 14
Top = 8
Width = 300
TabOrder = 10
OnChange=VisDir
Hint="§ à § !"
ShowHint=true
END CREATE
CREATE MaskBoxYes AS QCOMBOBOX
Text = "*.*htm*"
Left = 320
Top = 8
TabOrder = 2
Width =100
AddItems "*.txt", "*.*htm*", "*.", "*.*", "*.ctl"
END CREATE
CREATE DirTree AS QDIRTREE
Align=center
top=28
Left = 14
InitialDir = "c:\temp"
Width =300
Height =Form.ClientHeight /2
TabOrder=1
ShowHint=false
font.COLOR=clDred
visible=false
OnChange = ChangeDirectory
END CREATE
END CREATE
Setfocus(Edit1.handle): Edit1Hnd = GetFocus()
Setfocus(MaskBoxYes.handle): MaskBoxYesHnd = GetFocus()
Form.SHOWMODAL
SUB GoDirs
timeBeg=TIMER
Index=0
NumFiles=0
ListView.Clear
DEFINT nsd1, nsd2
DEFSTR mask
nsd1=0
nsd2=0
NumDir=0
ArrNumDir=500
DIM SubDir(0) AS STRING
IniDir$ =Edit1.text
mask="*"
SubDir(0)=IniDir$
FOR i=NSD1 TO Nsd2
SubDirname$=DIR$(SubDir(i)+mask, faDirectory)
WHILE SubDirname$ <>""
IF FileRec.Size =0 AND SubDirname$<> "." AND SubDirname$<> ".." THEN
INC adddir
INC NumDir
IF NumDir=ArrNumDir THEN ArrNumDir=ArrNumDir+300: REDIM SubDir(ArrNumDir) AS STRING
SubDir(NumDir)=SubDir(i)+SubDirname$+"\"
ELSE
END IF
SubDirname$=DIR$
DOEVENTS:IF stops1=1 THEN stops1=0: EXIT SUB
WEND
Fn$=DIR$(SubDir(i)+MaskBoxYes.Text,faAnyFile NOT faDirectory)
WHILE Fn$ <>""
IF Fn$<> "." AND Fn$<> ".." THEN
INC NumFiles
fn1$=SubDir(i)+Fn$
IF FILEEXISTS(fn1$)<>0 AND NumFiles<5000 THEN ListView.AddItems Fn1$
ELSE
END IF
Fn$=DIR$
WEND
Label1.CAPTION=STR$(NumFiles)
NEXT i
IF adddir>0 THEN
NSD1=NSD2+1
NSD2=NSD2+adddir
adddir=0
GOTO 1
ELSE
END IF
timeEnd=TIMER
Label1.CAPTION="All hits "+STR$(NumFiles)+" "+STR$(timeEnd-timeBeg)+" s"
SOUND 5000, 1
END SUB
SUB StopS
StopS1=1
END SUB
SUB VisDir(Button%, X%, Y%, Shift%)
Handle = GetFocus():
IF handle <> Edit1Hnd THEN DirTree.visible=false
END SUB
SUB ChangeDirectory
Edit1.text=DirTree.Directory
DirTree.visible=false
END SUB
SUB TimerOver
Form.CAPTION = "RQ GoDirs! "+dateR+" "+TIME$
Handle = GetFocus():
IF handle=Edit1Hnd THEN DirTree.visible=true
IF Handle=RichEdit1.Handle THEN DirTree.visible=false
IF Handle=MaskBoxYes.Handle THEN DirTree.visible=false
END SUB
|