FF.SetOption |
![]() ![]() |
nStatus = FF.SetOption( hHandle AS HANDLE, optiontype AS INTEGER, parameter AS VALUE ) AS INTEGER
Sets a search option. The type of the parameter depends on the search option. When searching for min or max, add the Min/Max modifier to the optiontype. When searching for text contents, you can add the text match criteria modifiers to the text search option.
The following Options are defined in MyBASIC2_ExtLib.BIS
' File Finder Option Types CONST EL_FF_OPT_Size = 0x00000001 CONST EL_FF_OPT_Modified = 0x00000002 CONST EL_FF_OPT_Created = 0x00000004 CONST EL_FF_OPT_Accessed = 0x00000008 CONST EL_FF_OPT_Attributes = 0x00000010 CONST EL_FF_OPT_Text = 0x00000020
' File Finder Set Min or Max Option Modifiers CONST EL_FF_OPT_Min = 0x01000000 CONST EL_FF_OPT_Max = 0x02000000
' File Finder Text Search Options Modifiers CONST EL_FF_TEXT_MatchCase = 0x00010000 CONST EL_FF_TEXT_MatchWord = 0x00020000
Example:
OPTION BASE 1
$LIBRARY "MyBASIC2_ExtLib" $INCLUDE "MyBASIC2_ExtLib"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' CLS
DIM hFF AS HANDLE DIM nFiles AS INTEGER DIM i AS INTEGER DIM tmpFile AS STRING
' Folder to Search CONST cFolder = "D:\Tech\Projects\COMMON\MyBASIC2\CodeTemplates"
' Open the File Finder and search for Code Template files hFF = FF.Open( cFolder, "*.ct2", TRUE )
' Find all "normal" files nFiles = FF.Find( hFF, EL_FF_NormalFiles )
' Print Result of Search FOR i = 1 TO nFiles PRINT FF.GetFilePath( hFF, i ), ENDFOR
PRINT , PRINT "Total File(s) "; FF.GetFileCount( hFF ),
' Let's reset and search for files with sizes between 1 and 5 kb FF.Reset( hFF ) FF.SetOption( hFF, EL_FF_OPT_Size+EL_FF_OPT_Min, 1024*1 ) FF.SetOption( hFF, EL_FF_OPT_Size+EL_FF_OPT_Max, 1024*5 )
' Find them nFiles = FF.Find( hFF, EL_FF_NormalFiles )
' Print Result of Search FOR i = 1 TO nFiles PRINT FF.GetFilePath( hFF, i ), ENDFOR
PRINT , PRINT "Total File(s) "; FF.GetFileCount( hFF ),
' Close the File Finder FF.Close( hFF )
END |