home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hot Shareware 32
/
hot34.iso
/
ficheros
/
LVB
/
T2W32523.ZIP
/
_FILE.FRM
< prev
next >
Wrap
Text File
|
1998-04-07
|
136KB
|
3,851 lines
VERSION 5.00
Object = "{0BA686C6-F7D3-101A-993E-0000C0EF6F5E}#1.0#0"; "THREED32.OCX"
Begin VB.Form frmFile
BorderStyle = 4 'Fixed ToolWindow
Caption = "File"
ClientHeight = 5805
ClientLeft = 1485
ClientTop = 2415
ClientWidth = 7785
MaxButton = 0 'False
MDIChild = -1 'True
PaletteMode = 1 'UseZOrder
ScaleHeight = 5805
ScaleWidth = 7785
ShowInTaskbar = 0 'False
Begin VB.TextBox txt_Result
BackColor = &H00C0C0C0&
BorderStyle = 0 'None
Height = 4425
Left = 105
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 630
Width = 7575
End
Begin Threed.SSPanel SSPanel1
Align = 1 'Align Top
Height = 480
Left = 0
TabIndex = 1
Top = 0
Width = 7785
_Version = 65536
_ExtentX = 13732
_ExtentY = 847
_StockProps = 15
ForeColor = -2147483640
BackColor = 12632256
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Begin VB.ComboBox cmb_Function
Height = 315
Left = 1365
TabIndex = 2
Top = 90
Width = 5100
End
Begin Threed.SSCommand cmdNP
Height = 300
Index = 1
Left = 7455
TabIndex = 6
Top = 90
Width = 255
_Version = 65536
_ExtentX = 450
_ExtentY = 529
_StockProps = 78
Caption = ">"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BevelWidth = 1
Font3D = 3
RoundedCorners = 0 'False
Outline = 0 'False
End
Begin Threed.SSCommand cmdNP
Height = 300
Index = 0
Left = 6615
TabIndex = 5
Top = 90
Width = 255
_Version = 65536
_ExtentX = 450
_ExtentY = 529
_StockProps = 78
Caption = "<"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BevelWidth = 1
Font3D = 3
RoundedCorners = 0 'False
Outline = 0 'False
End
Begin Threed.SSCommand SSCommand1
Default = -1 'True
Height = 300
Left = 6930
TabIndex = 3
Top = 90
Width = 465
_Version = 65536
_ExtentX = 820
_ExtentY = 529
_StockProps = 78
Caption = "&Go"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BevelWidth = 1
RoundedCorners = 0 'False
Outline = 0 'False
End
Begin VB.Label Label2
Caption = "&Select a function"
Height = 255
Left = 90
TabIndex = 4
Top = 120
Width = 1275
End
End
Begin VB.Label lblProgress
Height = 465
Left = 90
TabIndex = 7
Top = 5220
Visible = 0 'False
Width = 7575
End
End
Attribute VB_Name = "frmFile"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Option Base 1
Private Const Iteration = 10
Dim IsLoaded As Integer
Dim TimerStartOk As Integer
Dim TimerCloseOk As Integer
Dim TimerHandle As Integer
Dim TimerValue As Long
Private Sub cmdNP_Click(Index As Integer)
Call sub_NextPrev(cmb_Function, Index)
End Sub
Private Sub cmb_Function_Click()
If (IsLoaded = False) Then Exit Sub
Call cDisableFI(mdiT2W.Picture1)
txt_Result = ""
lblProgress.Visible = False
DoEvents
Select Case cmb_Function.ListIndex
Case 0
Call TestAllSubDirectories
Case 1
Call TestChDir
Case 2
Call TestChDrive
Case 3
Call TestFileCompressExpandTab
Case 4
Call TestFileCopy
Case 5
Call TestFileMove
Case 6
Call TestFileFilter
Case 7
Call TestFileFilterNot
Case 8
Call TestFileSize
Case 9
Call TestFileLineCount
Case 10
Call TestFileUpperLower
Case 11
Call TestFileMerge
Case 12
Call TestFileSearchAndReplace
Case 13
Call TestFileSearch
Case 14
Call TestFileSort(SORT_ASCENDING + SORT_CASE_SENSITIVE, False)
Case 15
Call TestFileSort(SORT_DESCENDING + SORT_CASE_SENSITIVE, False)
Case 16
Call TestFileSort(SORT_ASCENDING + SORT_CASE_INSENSITIVE, False)
Case 17
Call TestFileSort(SORT_DESCENDING + SORT_CASE_INSENSITIVE, False)
Case 18
Call TestFileSort(SORT_ASCENDING + SORT_CASE_SENSITIVE, True)
Case 19
Call TestFileSort(SORT_DESCENDING + SORT_CASE_SENSITIVE, True)
Case 20
Call TestFileSort(SORT_ASCENDING + SORT_CASE_INSENSITIVE, True)
Case 21
Call TestFileSort(SORT_DESCENDING + SORT_CASE_INSENSITIVE, True)
Case 22
Call TestFileChangeChars
Case 23
Call TestIsFileX
Case 24
Call TestKillDir
Case 25
Call TestKillDirs
Case 26
Call TestGetDiskSpace
Case 27
Call TestGetDiskUsed
Case 28
Call TestGetDiskFree
Case 29
Call TestGetDiskClusterSize
Case 30
Call TestCountFiles
Case 31
Call TestCountDirectories
Case 32
Call TestRcsCountFileDir
Case 33
Call TestFilesSizeX
Case 34
Call TestRcsFilesSizeX
Case 35
Call TestTruncatePath
Case 36
Call TestMakeSplitPath
Case 37
Call TestFullPath
Case 38
Call TestRenameFile
Case 39
Call TestUniqueFileName
Case 40
Call TestFilesInDirectory
Case 41
Call TestSubDirectory
Case 42
Call TestFileGetAttribute
Case 43
Call TestFileSetAttribute
Case 44
Call TestFileSetAllAttributes
Case 45
Call TestFileResetAllAttributes
Case 46
Call TestFileCompareX
Case 47
Call TestFileDrive
Case 48
Call TestFilesInDirOnDisk
Case 49
Call TestFileDateTime
Case 50
Call TestFileStatistics
Case 51
Call TestGetDriveType
Case 52
Call TestPBFileCopy
Case 53
Call TestDBFileCopy
Case 54
Call TestFileUUCP
Case 55
Call TestOpenFiles(ENUMERATE_ALL_OPEN_FILES)
Case 56
Call TestOpenFiles(ENUMERATE_ONLY_OPEN_UNMOVABLE_FILES)
Case 57
Call TestSplitFile
Case 58
Call TestCutFile
Case 59
Call TestGetFileDateTime
Case 60
Call TestSetFileDateTime
Case 61
Call TestFileMergeExt
Case 62
Call TestGetFileTypeName
Case 63
Call TestGetFileDisplayName
Case 64
Call TestFilesCopy
Case 65
lblProgress.Visible = True
Call TestFilesCopyExt
Case 66
Call TestShortCutFile
Case 67
Call TestFileLineCount2
Case 68
Call TestFileSearchFromLine
Case 69
Call TestFileSearchPatternFromLine
Case 70
Call TestFilePartAppend
Case 71
Call TestFilePartCopy
Case 72
Call TestFileScanHeader
Case 73
Call TestFileScanHeaderForRecipients
End Select
DoEvents
Call cEnableFI(mdiT2W.Picture1)
End Sub
Private Sub Form_Activate()
mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
End Sub
Private Sub Form_Load()
IsLoaded = False
Show
Call sub_Load_Combo(cmb_Function, T2WDirInst + "_file.t2w")
IsLoaded = True
End Sub
Private Sub SSCommand1_Click()
Call cmb_Function_Click
End Sub
Private Sub TestAllSubDirectories()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Long
strResult = ""
strDisplay = ""
i = -1
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
strResult = cAllSubDirectories("C:", i)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
strResult = cStringSAR(strResult, vbCr, vbCrLf, False)
strDisplay = "Directories founden on drive C are " & i & vbCrLf & vbCrLf & strResult
txt_Result = strDisplay
End Sub
Private Sub TestChDir()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
For i = 1 To 26
intResult = cChDir(Chr$(64 + i) & ":\")
If (intResult = True) Then
strDisplay = strDisplay & "ChDir to \ on '" & Chr$(64 + i) & ":' is " & IIf(intResult = True, "succesfull", "not successfull") & vbCrLf
End If
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cChDir("C:\")
Next i
intResult = cChDir(T2WDirTest)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestChDrive()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
For i = 1 To 26
intResult = cChDrive(Chr$(64 + i))
If (intResult = True) Then
strDisplay = strDisplay & "ChDrive on '" & Chr$(64 + i) & ":' is " & IIf(intResult = True, "succesfull", "not successfull") & vbCrLf
End If
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cChDrive("C")
Next i
intResult = cChDrive(T2WDirTest)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileCompressExpandTab()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
Dim File3 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.tabcompressed"
File3 = "autoexec.tabexpanded"
For i = 1 To 4
strDisplay = strDisplay & "File CompressTab (" & i & " spaces = 1 tab) " & File1 & " to " & File2 & " is " & cFileCompressTab(File1, File2, i) & vbCrLf
strDisplay = strDisplay & "File ExpandTab (" & i & " spaces = 1 tab) " & File2 & " to " & File3 & " is " & cFileExpandTab(File2, File3, i) & vbCrLf
strDisplay = strDisplay & "Compare file contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFileExpandTab(File1, File2, 3)
Next i
lResult = cFileCompressTab(File2, File3, 3)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileCopy()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.copy"
strDisplay = strDisplay & "File Copy '" & File1 & "' to '" & File2 & "' is " & cFileCopy(File1, File2) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Copy2 '" & File1 & "' to '" & File2 & "' is " & cFileCopy2(File1, File2) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Force Copy '" & File1 & "' to '" & File2 & "' is " & cFileForceCopy(File1, File2, True) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFileCopy(File1, File2)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileMove()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = cGetWindowsDirectory() & "\autoexec.bat"
strDisplay = strDisplay & "File Move '" & File1 & "' to '" & File2 & "' is " & cFileMove(File1, File2) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFileMove(File1, File2)
Next i
lResult = cFileCopy(File2, File1)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileFilter()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
Dim Filter As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.filter"
Filter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Filter = Filter + LCase$(Filter)
strDisplay = strDisplay & "File Filter (A-Z, a-z) '" & File1 & "' to '" & File2 & "' is " & cFileFilter(File1, File2, Filter) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFileFilter(File1, File2, Filter)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileFilterNot()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
Dim Filter As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.filternot"
Filter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Filter = Filter + LCase$(Filter)
strDisplay = strDisplay & "File Filter Not (A-Z, a-z) '" & File1 & "' to '" & File2 & "' is " & cFileFilter(File1, File2, Filter) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFileFilterNot(File1, File2, Filter)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileSize()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
strDisplay = strDisplay & "File Size '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
File1 = "c:\autoexec.bat"
strDisplay = strDisplay & "File Size '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
File1 = "c:\config.sys"
strDisplay = strDisplay & "File Size '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
File1 = "c:\test.tst"
strDisplay = strDisplay & "File Size '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
File1 = "c:\command.com"
strDisplay = strDisplay & "File Size '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFileSize(File1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileLineCount()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
strDisplay = strDisplay & "Total lines in '" & File1 & "' are " & cFileLineCount(File1) & vbCrLf & vbCrLf
File1 = "c:\autoexec.bat"
strDisplay = strDisplay & "Total lines in '" & File1 & "' are " & cFileLineCount(File1) & vbCrLf & vbCrLf
File1 = "c:\config.sys"
strDisplay = strDisplay & "Total lines in '" & File1 & "' are " & cFileLineCount(File1) & vbCrLf & vbCrLf
File1 = "c:\test.tst"
strDisplay = strDisplay & "Total lines in '" & File1 & "' are " & cFileLineCount(File1) & vbCrLf & vbCrLf
File1 = "c:\command.com"
strDisplay = strDisplay & "Total lines in '" & File1 & "' are " & cFileLineCount(File1) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
File1 = "D:\Program Files\DevStudio\VB\Winapi\Win32api.txt"
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFileLineCount(File1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Public Sub TestFileUpperLower()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
Dim File3 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.toupper"
File3 = "autoexec.tolower"
strDisplay = strDisplay & "File to upper '" & File1 & "' to '" & File2 & "' is " & cFileToUpper(File1, File2) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File to lower '" & File1 & "' to '" & File3 & "' is " & cFileToLower(File1, File3) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFileToUpper(File1, File2)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileMerge()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
Dim File3 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "c:\config.sys"
File3 = "autoexec.merged"
strDisplay = strDisplay & "File Merge '" & File1 & "' and '" & File2 & "' to '" & File3 & "' is " & cFileMerge(File1, File2, File3) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFileMerge(File1, File2, File3)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileSearchAndReplace()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
Dim Search As String
Dim Replace As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.searchandreplace"
Search = "rem" ' SET "
Replace = "REM" ' set "
strDisplay = strDisplay & "File Copy '" & File1 & "' to '" & File2 & "' is " & cFileCopy(File1, File2) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search-Replace (sensitive) : '" & Search & "' -> '" & Replace & "' in '" & File2 & "' is " & cFileSearchAndReplace(File2, Search, Replace, "tmp.tmp", True) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search-Replace (sensitive) : '" & Replace & "' -> '" & Search & "' in '" & File2 & "' is " & cFileSearchAndReplace(File2, Replace, Search, "tmp.tmp", True) & vbCrLf & vbCrLf
strDisplay = strDisplay & "Compare file contents (insensitive) '" & File2 & "' with '" & File1 & "' is " & IIf(cCmpFileContents(File2, File1, False) = True, "same", "not same") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
If ((i Mod 2) = 1) Then
lResult = cFileSearchAndReplace(File1, Search, Replace, "", True)
Else
lResult = cFileSearchAndReplace(File1, Search, Replace, "", True)
End If
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileSearch()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim Search1 As String
Dim Search2 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
Search1 = "re"
Search2 = "SET"
strDisplay = strDisplay & "File Search (insensitive) : '" & Search1 & "' in '" & File1 & "' is " & cFileSearch(File1, Search1, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search and Count (insensitive) : '" & Search1 & "' in '" & File1 & "' is " & cFileSearchCount(File1, Search1, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search (insensitive) : '" & Search2 & "' in '" & File1 & "' is " & cFileSearch(File1, Search2, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search and Count (insensitive) : '" & Search2 & "' in '" & File1 & "' is " & cFileSearchCount(File1, Search2, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search (sensitive) : '" & Search1 & "' in '" & File1 & "' is " & cFileSearch(File1, Search1, True) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search and Count (sensitive) : '" & Search1 & "' in '" & File1 & "' is " & cFileSearchCount(File1, Search1, True) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search (sensitive) : '" & Search2 & "' in '" & File1 & "' is " & cFileSearch(File1, Search2, True) & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search and Count (sensitive) : '" & Search2 & "' in '" & File1 & "' is " & cFileSearchCount(File1, Search2, True) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
If ((i Mod 2) = 1) Then
lResult = cFileSearch(File1, Search1, False)
Else
lResult = cFileSearchCount(File1, Search2, False)
End If
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileSort(intSortMethod As Integer, intVarFix As Integer)
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim n As Long
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.sort" & intSortMethod & Abs(intVarFix)
strDisplay = "The 7 first lines in '" & File1 & "' before sorting are " & vbCrLf & vbCrLf
Close #1
Open File1 For Input Shared As #1
For i = 1 To 7
Line Input #1, strResult
strDisplay = strDisplay + strResult + vbCrLf
Next i
Close #1
If (intVarFix = False) Then
lResult = cFileSort(File1, File2, intSortMethod, -1, -1, -1, n)
Else
lResult = cFileSort(File1, File2, intSortMethod, 7, 0, 7, n)
End If
strDisplay = strDisplay + vbCrLf
strDisplay = strDisplay + "The 7 first lines in '" & File2 & "' after sorting are " & vbCrLf & vbCrLf
Close #1
Open File2 For Input Shared As #1
For i = 1 To 7
Line Input #1, strResult
strDisplay = strDisplay + strResult + vbCrLf
Next i
Close #1
strDisplay = strDisplay + vbCrLf
Select Case intSortMethod
Case (SORT_ASCENDING + SORT_CASE_SENSITIVE):
strDisplay = strDisplay + "Sort '" & File1 & "' into '" & File2 & "' in ASC and CS is '" & lResult & "' and records are '" & n & "'"
Case (SORT_DESCENDING + SORT_CASE_SENSITIVE):
strDisplay = strDisplay + "Sort '" & File1 & "' into '" & File2 & "' in DSC and CS is '" & lResult & "' and records are '" & n & "'"
Case (SORT_ASCENDING + SORT_CASE_INSENSITIVE):
strDisplay = strDisplay + "Sort '" & File1 & "' into '" & File2 & "' in ASC and NS is '" & lResult & "' and records are '" & n & "'"
Case (SORT_DESCENDING + SORT_CASE_INSENSITIVE):
strDisplay = strDisplay + "Sort '" & File1 & "' into '" & File2 & "' in DSC and NS is '" & lResult & "' and records are '" & n & "'"
End Select
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFileSort(File1, File2, intSortMethod, -1, -1, -1, n)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileChangeChars()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
Dim Change1 As String
Dim Change2 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.changechars"
Change1 = "REM"
Change2 = "mer"
txt_Result = strDisplay
strDisplay = strDisplay & "File Copy '" & File1 & "' to '" & File2 & "' is " & cFileCopy(File1, File2) & vbCrLf & vbCrLf
strDisplay = strDisplay & "The 7 first lines in '" & File2 & "' before change are " & vbCrLf & vbCrLf
Close #1
Open File2 For Input Shared As #1
For i = 1 To 7
Line Input #1, strResult
strDisplay = strDisplay + strResult + vbCrLf
Next i
Close #1
strDisplay = strDisplay + vbCrLf
strDisplay = strDisplay & "File Change Chars : '" & Change1 & "' -> '" & Change2 & "' in '" & File2 & "' is " & cFileChangeChars(File2, Change1, Change2, "file1.file1") & vbCrLf & vbCrLf
strDisplay = strDisplay & "The 7 first lines in '" & File2 & "' after change are " & vbCrLf & vbCrLf
Close #1
Open File2 For Input Shared As #1
For i = 1 To 7
Line Input #1, strResult
strDisplay = strDisplay + strResult + vbCrLf
Next i
Close #1
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
If ((i Mod 2) = 1) Then
lResult = cFileChangeChars(File2, Change1, Change2, "")
Else
lResult = cFileChangeChars(File2, Change2, Change1, "")
End If
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestIsFileX()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
strDisplay = strDisplay & "File '" & File1 & "' is " & vbCrLf & vbCrLf
strDisplay = strDisplay & IIf(cIsFilenameValid(File1), " a good filename", " is not a good filename") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileArchive(File1), " archive", " not archive") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileHidden(File1), " hidden", " not hidden") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileNormal(File1), " normal", " not normal") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileReadOnly(File1), " read-only", " not read-only") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileSubDir(File1), " sub-directory", " not sub-directory") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileSystem(File1), " system", " not system") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileCompressed(File1), " compressed", " not compressed") & vbCrLf & vbCrLf
File1 = cGetWindowsDirectory() & "\user.dat"
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "' is " & vbCrLf & vbCrLf
strDisplay = strDisplay & IIf(cIsFilenameValid(File1), " a good filename", " is not a good filename") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileArchive(File1), " archive", " not archive") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileHidden(File1), " hidden", " not hidden") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileNormal(File1), " normal", " not normal") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileReadOnly(File1), " read-only", " not read-only") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileSubDir(File1), " sub-directory", " not sub-directory") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileSystem(File1), " system", " not system") & vbCrLf
strDisplay = strDisplay & IIf(cIsFileCompressed(File1), " compressed", " not compressed") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cIsFilenameValid(File1)
Next i
intResult = cChDir(T2WDirTest)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestKillDir()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = "c:\this is a test for KillDir"
intResult = cMakeDir(File1)
strDisplay = strDisplay & "Directory '" & File1 & "' is created" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Directory '" & File1 & "' is " & IIf(cKillDir(File1) = True, "deleted", "not deleted") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cKillDir(File1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestKillDirs()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = "c:\this1\this2\this3\this4"
intResult = cMakeMultipleDir(File1)
strDisplay = strDisplay & "Directories '" & File1 & "' are created" & vbCrLf & vbCrLf
intResult = cKillDirs("c:\this1", False)
strDisplay = strDisplay & "Directories '" & File1 & "' (except c:\this) are " & IIf(intResult, "deleted (total : " & intResult & ")", "not deleted") & vbCrLf & vbCrLf
strDisplay = strDisplay & "Directories '" & File1 & "' are recreated" & vbCrLf & vbCrLf
intResult = cMakeMultipleDir(File1)
intResult = cKillDirs("c:\this1", True)
strDisplay = strDisplay & "Directories '" & File1 & "' (include c:\this) are " & IIf(intResult, "deleted (total : " & intResult & ")", "not deleted") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cKillDirs(File1, True)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestGetDiskSpace()
Dim lResult As Double
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
For i = 1 To 26
lResult = cGetDiskSpace(Chr$(64 + i))
If (lResult <> True) Then
strDisplay = strDisplay & "DiskSpace for '" & Chr$(64 + i) & ":' is " & lResult & vbCrLf
End If
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cGetDiskSpace("C")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestGetDiskUsed()
Dim lResult As Double
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
For i = 1 To 26
lResult = cGetDiskUsed(Chr$(64 + i))
If (lResult <> True) Then
strDisplay = strDisplay & "DiskSpace for '" & Chr$(64 + i) & ":' is " & lResult & vbCrLf
End If
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cGetDiskUsed("C")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestGetDiskFree()
Dim lResult As Double
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
For i = 1 To 26
lResult = cGetDiskFree(Chr$(64 + i))
If (lResult <> True) Then
strDisplay = strDisplay & "DiskSpace for '" & Chr$(64 + i) & ":' is " & lResult & vbCrLf
End If
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cGetDiskFree("C")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestGetDiskClusterSize()
Dim lResult As Double
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
For i = 1 To 26
lResult = cGetDiskClusterSize(Chr$(64 + i))
If (lResult <> True) Then
strDisplay = strDisplay & "DiskSpace for '" & Chr$(64 + i) & ":' is " & lResult & vbCrLf
End If
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cGetDiskClusterSize("C")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestRcsCountFileDir()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
strDisplay = strDisplay & "Total directories in C: is " & cRcsCountFileDir(False, "C:", "", True) & vbCrLf
strDisplay = strDisplay & "Total directories in D: is " & cRcsCountFileDir(False, "D:", "", True) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Total files in C: is " & cRcsCountFileDir(True, "C:", "", True) & vbCrLf
strDisplay = strDisplay & "Total files in D: is " & cRcsCountFileDir(True, "D:", "", True) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Total files in C:*.DAT is " & cRcsCountFileDir(True, "C:", "*.DAT", True) & vbCrLf
strDisplay = strDisplay & "Total files in D:*.DAT is " & cRcsCountFileDir(True, "D:", "*.DAT", True) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Total directories in C:\ is " & cRcsCountFileDir(False, "C:", "", False) & vbCrLf
strDisplay = strDisplay & "Total directories in D:\ is " & cRcsCountFileDir(False, "D:", "", False) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Total files in C:\ is " & cRcsCountFileDir(True, "C:", "", False) & vbCrLf
strDisplay = strDisplay & "Total files in D:\ is " & cRcsCountFileDir(True, "D:", "", False) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Total files in C:\*.DAT is " & cRcsCountFileDir(True, "C:", "*.DAT", False) & vbCrLf
strDisplay = strDisplay & "Total files in D:\*.DAT is " & cRcsCountFileDir(True, "D:", "*.DAT", False) & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cRcsCountFileDir(False, "C:", "", False)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestCountFiles()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
strDisplay = strDisplay & "Number of files in C:\ is " & cCountFiles("C:\*.*") & vbCrLf & vbCrLf
strDisplay = strDisplay & "Number of files in D:\ is " & cCountFiles("D:\*.*") & vbCrLf & vbCrLf
strDisplay = strDisplay & "Number of files in E:\ is " & cCountFiles("E:\*.*") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cCountFiles("C:\*.*")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestCountDirectories()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
strDisplay = strDisplay & "Number of directories in C:\ is " & cCountDirectories("C:\*.*") & vbCrLf & vbCrLf
strDisplay = strDisplay & "Number of directories in D:\ is " & cCountDirectories("D:\*.*") & vbCrLf & vbCrLf
strDisplay = strDisplay & "Number of directories in E:\ is " & cCountDirectories("E:\*.*") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cCountDirectories("C:\*.*")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFilesSizeX()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim Size1 As Double
Dim Size2 As Double
strResult = ""
strDisplay = ""
strDisplay = strDisplay & "Size of files c:\* is " & cFilesSize("c:\*.*") & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.bat is " & cFilesSize("c:\*.bat") & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.sys is " & cFilesSize("c:\*.sys") & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.com is " & cFilesSize("c:\*.com") & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Size of files c:\* on disk is " & cFilesSizeOnDisk("c:\*.*") & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.bat on disk is " & cFilesSizeOnDisk("c:\*.bat") & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.sys on disk is " & cFilesSizeOnDisk("c:\*.sys") & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.com on disk is " & cFilesSizeOnDisk("c:\*.com") & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Slack of files c:\* on disk is " & cFilesSlack("c:\*.*", Size1, Size2) & " %" & vbCrLf
strDisplay = strDisplay & "Slack of files c:\*.bat on disk is " & cFilesSlack("c:\*.bat", Size1, Size2) & " %" & vbCrLf
strDisplay = strDisplay & "Slack of files c:\*.sys on disk is " & cFilesSlack("c:\*.sys", Size1, Size2) & " %" & vbCrLf
strDisplay = strDisplay & "Slack of files c:\*.com on disk is " & cFilesSlack("c:\*.com", Size1, Size2) & " %" & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFilesSize("c:\*.*")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestRcsFilesSizeX()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim Size1 As Double
Dim Size2 As Double
strResult = ""
strDisplay = ""
'For i = 67 To 70
'
' strDisplay = strDisplay & "Total directories in " & Chr$(i) & ": is " & cRcsCountFileDir(False, Chr$(i) & ":", "", True) & vbCrLf
' strDisplay = strDisplay & "Total files in " & Chr$(i) & ": is " & cRcsCountFileDir(True, Chr$(i) & ":", "", True) & vbCrLf
' strDisplay = strDisplay & "Size of files " & Chr$(i) & ": is " & cRcsFilesSize(Chr$(i) & ":\", "*.*", True) & vbCrLf
' strDisplay = strDisplay & "Size of files " & Chr$(i) & ": on disk is " & cRcsFilesSizeOnDisk(Chr$(i) & ":\", "*.*", True) & vbCrLf
' strDisplay = strDisplay & "Slack of files starting with " & Chr$(i) & ": on disk is " & cRcsFilesSlack(Chr$(i) & ":\", "*.*", True, Size1, Size2) & " %" & vbCrLf & vbCrLf
'
'Next i
'
'txt_Result = strDisplay
'Exit Sub
strDisplay = strDisplay & "Size of files c:\* is " & cRcsFilesSize("c:\", "*", False) & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.exe is " & cRcsFilesSize("c:\", "*.exe", False) & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.com is " & cRcsFilesSize("c:\", "*.com", False) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Size of files c:\* on disk is " & cRcsFilesSizeOnDisk("c:\", "*", False) & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.exe on disk is " & cRcsFilesSizeOnDisk("c:\", "*.exe", False) & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.com on disk is " & cRcsFilesSizeOnDisk("c:\", "*.com", False) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Slack of files c:\* on disk is " & cRcsFilesSlack("c:\", "*", False, Size1, Size2) & " %" & vbCrLf
strDisplay = strDisplay & "Slack of files c:\*.exe on disk is " & cRcsFilesSlack("c:\", "*.exe", False, Size1, Size2) & " %" & vbCrLf
strDisplay = strDisplay & "Slack of files c:\*.com on disk is " & cRcsFilesSlack("c:\", "*.com", False, Size1, Size2) & " %" & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Size of files c:\* is " & cRcsFilesSize("c:\", "*", True) & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.exe is " & cRcsFilesSize("c:\", "*.exe", True) & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.com is " & cRcsFilesSize("c:\", "*.com", True) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Size of files c:\* on disk is " & cRcsFilesSizeOnDisk("c:\", "*", True) & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.exe on disk is " & cRcsFilesSizeOnDisk("c:\", "*.exe", True) & vbCrLf
strDisplay = strDisplay & "Size of files c:\*.com on disk is " & cRcsFilesSizeOnDisk("c:\", "*.com", True) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Slack of files c:\* on disk is " & cRcsFilesSlack("c:\", "*", True, Size1, Size2) & " %" & vbCrLf
strDisplay = strDisplay & "Slack of files c:\*.exe on disk is " & cRcsFilesSlack("c:\", "*.exe", True, Size1, Size2) & " %" & vbCrLf
strDisplay = strDisplay & "Slack of files c:\*.com on disk is " & cRcsFilesSlack("c:\", "*.com", True, Size1, Size2) & " %" & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cRcsFilesSize("c:\", "*", False)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestTruncatePath()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
strDisplay = strDisplay & "Truncate the following path with a length of 25" & vbCrLf & vbCrLf
File1 = "t2win-16.bas"
strResult = cTruncatePath(File1, 25)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf
File1 = "windows\system\t2win-16.bas"
strResult = cTruncatePath(File1, 25)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf
File1 = cGetSystemDirectory & "\t2win-16.bas"
strResult = cTruncatePath(File1, 25)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf
File1 = cGetSystemDirectory & "\visual\t2win-16\t2win-16.bas"
strResult = cTruncatePath(File1, 25)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf
File1 = cGetSystemDirectory & "\visual\source\t2win-16\t2win-16.bas"
strResult = cTruncatePath(File1, 25)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Truncate the following path with a length of 35" & vbCrLf & vbCrLf
File1 = "t2win-16.bas"
strResult = cTruncatePath(File1, 35)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf
File1 = "windows\system\t2win-16.bas"
strResult = cTruncatePath(File1, 35)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf
File1 = cGetSystemDirectory & "\t2win-16.bas"
strResult = cTruncatePath(File1, 35)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf
File1 = cGetSystemDirectory & "\visual\t2win-16\t2win-16.bas"
strResult = cTruncatePath(File1, 35)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf
File1 = cGetSystemDirectory & "\visual\source\t2win-16\t2win-16.bas"
strResult = cTruncatePath(File1, 35)
strDisplay = strDisplay & File1 & vbCrLf & " -> " & strResult & " (len=" & Len(strResult) & ")" & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cTruncatePath(File1, 35)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestMakeSplitPath()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim SPLITPATH As tagSPLITPATH
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = cMakePath("c", "\this is a test", "test", "dat")
strDisplay = strDisplay & "Make Path of (c,\this is a test,test,dat) is '" & File1 & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Split Path '" & File1 & "' into four components is :" & vbCrLf & vbCrLf
intResult = cSplitPath(File1, SPLITPATH)
strDisplay = strDisplay & Space$(3) & SPLITPATH.nDrive & vbCrLf
strDisplay = strDisplay & Space$(3) & SPLITPATH.nDir & vbCrLf
strDisplay = strDisplay & Space$(3) & SPLITPATH.nName & vbCrLf
strDisplay = strDisplay & Space$(3) & SPLITPATH.nExt & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cMakePath("c", "this is a test", "test", "dat")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFullPath()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
strDisplay = strDisplay & "Full Path of " & File1 & " is " & cFullPath(File1) & vbCrLf & vbCrLf
File1 = cGetSystemDirectory() & "\t2win-32.dll"
strDisplay = strDisplay & "Full Path of " & File1 & " is " & cFullPath(File1) & vbCrLf & vbCrLf
File1 = cFilesInDirectory(cGetDefaultCurrentDir() + "\*.*", True)
strDisplay = strDisplay & "Full Path of " & File1 & " is " & cFullPath(File1) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cFullPath(File1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestRenameFile()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = "this.is.a.test.~~~"
File2 = "an another test.---"
intResult = cKillFile(File1)
intResult = cKillFile(File2)
Close #1
Open File1 For Output Shared As #1
Print #1, File1
Print #1, File2
Close #1
strDisplay = "File '" & File1 & "' " & IIf(cRenameFile(File1, File2) = True, "renamed in '" & File2 & "'", "is not renamed") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cRenameFile(File1, File2)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Public Sub TestUniqueFileName()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = "WN"
strDisplay = strDisplay + "Generate unique filename with template '" & File1 & "' is '" & cUniqueFileName(File1) & "'" & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cUniqueFileName(File1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFilesInDirectory()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = "*.*"
strDisplay = strDisplay + "The 10 first files in the current directory '" & cGetDriveCurrentDir("C") & "'" & vbCrLf & vbCrLf
strResult = cFilesInDirectory(File1, True)
For i = 1 To 15
strDisplay = strDisplay & strResult & vbCrLf
strResult = cFilesInDirectory(File1, False)
Next i
strDisplay = strDisplay + vbCrLf
File1 = "C:\*.*"
strDisplay = strDisplay + "The 10 first files in '" & File1 & "'" & vbCrLf & vbCrLf
strResult = cFilesInDirectory(File1, True)
For i = 1 To 10
strDisplay = strDisplay & strResult & vbCrLf
strResult = cFilesInDirectory(File1, False)
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cFilesInDirectory(File1, True)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestSubDirectory()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = "*.*"
strDisplay = strDisplay + "The 10 first directory in the current directory '" & cGetDriveCurrentDir("C") & "'" & vbCrLf & vbCrLf
strResult = cSubDirectory(File1, True)
For i = 1 To 10
strDisplay = strDisplay & strResult & vbCrLf
strResult = cSubDirectory(File1, False)
Next i
strDisplay = strDisplay + vbCrLf
File1 = "C:\*.*"
strDisplay = strDisplay + "The 10 first directory in '" & File1 & "'" & vbCrLf & vbCrLf
strResult = cSubDirectory(File1, True)
For i = 1 To 10
strDisplay = strDisplay & strResult & vbCrLf
strResult = cSubDirectory(File1, False)
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cSubDirectory(File1, True)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileGetAttribute()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
Dim FileAttrib As FileAttributeType
strResult = ""
strDisplay = ""
File1 = cFilesInDirectory("*.*", True)
intResult = cFileGetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Archive, " is Archive", " is not Archive") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Hidden, " is Hidden", " is not Hidden") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Normal, " is Normal", " is not Normal") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.ReadOnly, " is ReadOnly", " is not ReadOnly") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.SubDir, " is SubDir", " is not SubDir") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.System, " is System", " is not System") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Compressed, " is Compressed", " is not Compressed") & vbCrLf & vbCrLf
File1 = cGetWindowsDirectory() & "\user.dat"
intResult = cFileGetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Archive, " is Archive", " is not Archive") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Hidden, " is Hidden", " is not Hidden") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Normal, " is Normal", " is not Normal") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.ReadOnly, " is ReadOnly", " is not ReadOnly") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.SubDir, " is SubDir", " is not SubDir") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.System, " is System", " is not System") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Compressed, " is Compressed", " is not Compressed") & vbCrLf & vbCrLf
File1 = cSubDirectory("c:\*.*", True)
File1 = cSubDirectory("c:\*.*", False)
File1 = cSubDirectory("c:\*.*", False)
File1 = "c:\" & File1
intResult = cFileGetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Archive, " is Archive", " is not Archive") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Hidden, " is Hidden", " is not Hidden") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Normal, " is Normal", " is not Normal") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.ReadOnly, " is ReadOnly", " is not ReadOnly") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.SubDir, " is SubDir", " is not SubDir") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.System, " is System", " is not System") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Compressed, " is Compressed", " is not Compressed") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cFileGetAttrib(File1, FileAttrib)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileSetAttribute()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
Dim FileAttrib As FileAttributeType
strResult = ""
strDisplay = ""
File1 = cFilesInDirectory("*.*", True)
intResult = cFileGetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Archive, " is Archive", " is not Archive") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Hidden, " is Hidden", " is not Hidden") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Normal, " is Normal", " is not Normal") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.ReadOnly, " is ReadOnly", " is not ReadOnly") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.SubDir, " is SubDir", " is not SubDir") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.System, " is System", " is not System") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Compressed, " is Compressed", " is not Compressed") & vbCrLf & vbCrLf
FileAttrib.Archive = False
FileAttrib.Hidden = True
FileAttrib.ReadOnly = True
FileAttrib.System = True
intResult = cFileSetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "Setting attribute (not archive, hidden, readonly, system) to file '" & File1 & "' is " & intResult & vbCrLf & vbCrLf
intResult = cFileGetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Archive, " is Archive", " is not Archive") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Hidden, " is Hidden", " is not Hidden") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Normal, " is Normal", " is not Normal") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.ReadOnly, " is ReadOnly", " is not ReadOnly") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.SubDir, " is SubDir", " is not SubDir") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.System, " is System", " is not System") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Compressed, " is Compressed", " is not Compressed") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cFileSetAttrib(File1, FileAttrib)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileSetAllAttributes()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
Dim FileAttrib As FileAttributeType
strResult = ""
strDisplay = ""
File1 = cFilesInDirectory("*.*", True)
intResult = cFileGetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Archive, " is Archive", " is not Archive") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Hidden, " is Hidden", " is not Hidden") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Normal, " is Normal", " is not Normal") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.ReadOnly, " is ReadOnly", " is not ReadOnly") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.SubDir, " is SubDir", " is not SubDir") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.System, " is System", " is not System") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Compressed, " is Compressed", " is not Compressed") & vbCrLf & vbCrLf
intResult = cFileSetAllAttrib(File1)
strDisplay = strDisplay & "Resetting all attributes (except normal, compressed) to file '" & File1 & "' is " & intResult & vbCrLf & vbCrLf
intResult = cFileGetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Archive, " is Archive", " is not Archive") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Hidden, " is Hidden", " is not Hidden") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Normal, " is Normal", " is not Normal") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.ReadOnly, " is ReadOnly", " is not ReadOnly") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.SubDir, " is SubDir", " is not SubDir") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.System, " is System", " is not System") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Compressed, " is Compressed", " is not Compressed") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cFileSetAllAttrib(File1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Public Sub TestFileResetAllAttributes()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
Dim FileAttrib As FileAttributeType
strResult = ""
strDisplay = ""
File1 = cFilesInDirectory("*.*", True)
intResult = cFileGetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Archive, " is Archive", " is not Archive") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Hidden, " is Hidden", " is not Hidden") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Normal, " is Normal", " is not Normal") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.ReadOnly, " is ReadOnly", " is not ReadOnly") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.SubDir, " is SubDir", " is not SubDir") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.System, " is System", " is not System") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Compressed, " is Compressed", " is not Compressed") & vbCrLf & vbCrLf
intResult = cFileResetAllAttrib(File1)
strDisplay = strDisplay & "Resetting all attributes (except normal, compressed) to file '" & File1 & "' is " & intResult & vbCrLf & vbCrLf
intResult = cFileGetAttrib(File1, FileAttrib)
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Archive, " is Archive", " is not Archive") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Hidden, " is Hidden", " is not Hidden") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Normal, " is Normal", " is not Normal") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.ReadOnly, " is ReadOnly", " is not ReadOnly") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.SubDir, " is SubDir", " is not SubDir") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.System, " is System", " is not System") & vbCrLf
strDisplay = strDisplay & "File '" & File1 & "'" & IIf(FileAttrib.Compressed, " is Compressed", " is not Compressed") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cFileResetAllAttrib(File1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Public Sub TestFileCompareX()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
Dim File2 As String
Dim FileAttrib As FileAttributeType
strResult = ""
strDisplay = ""
File1 = T2WFileTest
File2 = "autoexec.compare"
strDisplay = strDisplay & "File Copy '" & File1 & "' to '" & File2 & "' is " & cFileCopy(File1, File2) & vbCrLf & vbCrLf
strDisplay = strDisplay & "Compare file attribute '" & File1 & "' with '" & File2 & "' is " & cCmpFileAttribute(File1, File2) & vbCrLf
strDisplay = strDisplay & "Compare file size '" & File1 & "' with '" & File2 & "' is " & cCmpFileSize(File1, File2) & vbCrLf
strDisplay = strDisplay & "Compare file time '" & File1 & "' with '" & File2 & "' is " & cCmpFileTime(File1, File2) & vbCrLf
strDisplay = strDisplay & "Compare file contents (case sensitive) '" & File1 & "' with '" & File2 & "' is " & cCmpFileContents(File1, File2, True) & vbCrLf
strDisplay = strDisplay & "Compare file contents (not sensitive) '" & File1 & "' with '" & File2 & "' is " & cCmpFileContents(File1, File2, False) & vbCrLf & vbCrLf
Close #1
Open File2 For Append Shared As #1
Print #1, File2
Close #1
strDisplay = strDisplay & "Appending " & (Len(File2) + 2) & " chars to '" & File2 & "'" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Compare file attribute '" & File1 & "' with '" & File2 & "' is " & cCmpFileAttribute(File1, File2) & vbCrLf
strDisplay = strDisplay & "Compare file size '" & File1 & "' with '" & File2 & "' is " & cCmpFileSize(File1, File2) & vbCrLf
strDisplay = strDisplay & "Compare file time '" & File1 & "' with '" & File2 & "' is " & cCmpFileTime(File1, File2) & vbCrLf
strDisplay = strDisplay & "Compare file contents (case sensitive) '" & File1 & "' with '" & File2 & "' is " & cCmpFileContents(File1, File2, True) & vbCrLf
strDisplay = strDisplay & "Compare file contents (not sensitive) '" & File1 & "' with '" & File2 & "' is " & cCmpFileContents(File1, File2, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "Resetting all attributes (except normal, compressed) is " & cFileResetAllAttrib(File2) & vbCrLf & vbCrLf
strDisplay = strDisplay & "Compare file attribute '" & File1 & "' with '" & File2 & "' is " & cCmpFileAttribute(File1, File2) & vbCrLf
strDisplay = strDisplay & "Compare file size '" & File1 & "' with '" & File2 & "' is " & cCmpFileSize(File1, File2) & vbCrLf
strDisplay = strDisplay & "Compare file time '" & File1 & "' with '" & File2 & "' is " & cCmpFileTime(File1, File2) & vbCrLf
strDisplay = strDisplay & "Compare file contents (case sensitive) '" & File1 & "' with '" & File2 & "' is " & cCmpFileContents(File1, File2, True) & vbCrLf
strDisplay = strDisplay & "Compare file contents (not sensitive) '" & File1 & "' with '" & File2 & "' is " & cCmpFileContents(File1, File2, False) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cCmpFileSize(File1, File2)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileDrive()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
strDisplay = strDisplay & "File drive of '" & File1 & "' is " & cFileDrive(File1) & vbCrLf & vbCrLf
File1 = cGetWindowsDirectory() + "\user.dat"
strDisplay = strDisplay & "File drive of '" & File1 & "' is " & cFileDrive(File1) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cFileDrive(File1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFilesInDirOnDisk()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = "filesindirondisk.temp"
File2 = "c:\*.*"
strDisplay = strDisplay & "Number of files '" & File2 & "' (with at least one of the following attribute)" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Any : " & cFilesInDirOnDisk(File1, File2, A_ALL) & vbCrLf
strDisplay = strDisplay & "(N)ormal : " & cFilesInDirOnDisk(File1, File2, A_NORMAL) & vbCrLf
strDisplay = strDisplay & "(A)rchive, (N)ormal : " & cFilesInDirOnDisk(File1, File2, A_NORMAL_ARCHIVE) & vbCrLf
strDisplay = strDisplay & "(A)rchive : " & cFilesInDirOnDisk(File1, File2, A_ARCHIVE) & vbCrLf
strDisplay = strDisplay & "(A)rchive, (R)ead-Only : " & cFilesInDirOnDisk(File1, File2, A_ARCHIVE Or A_RDONLY) & vbCrLf
strDisplay = strDisplay & "(S)ystem, (H)idden, (R)ead-Only : " & cFilesInDirOnDisk(File1, File2, A_SYSTEM Or A_HIDDEN Or A_RDONLY) & vbCrLf
strDisplay = strDisplay & "(H)idden, (R)ead-Only : " & cFilesInDirOnDisk(File1, File2, A_HIDDEN Or A_RDONLY) & vbCrLf
strDisplay = strDisplay & "(R)ead-Only : " & cFilesInDirOnDisk(File1, File2, A_RDONLY) & vbCrLf
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Number of files in '" & File2 & "' (with exact attribute excluding all others)" & vbCrLf & vbCrLf
strDisplay = strDisplay & "(N)ormal : " & cFilesInDirOnDisk(File1, File2, -(A_NORMAL)) & vbCrLf
strDisplay = strDisplay & "(A)rchive, (N)ormal : " & cFilesInDirOnDisk(File1, File2, -(A_NORMAL_ARCHIVE)) & vbCrLf
strDisplay = strDisplay & "(A)rchive : " & cFilesInDirOnDisk(File1, File2, -(A_ARCHIVE)) & vbCrLf
strDisplay = strDisplay & "(A)rchive, (R)ead-Only : " & cFilesInDirOnDisk(File1, File2, -(A_ARCHIVE Or A_RDONLY)) & vbCrLf
strDisplay = strDisplay & "(S)ystem, (H)idden, (R)ead-Only : " & cFilesInDirOnDisk(File1, File2, -(A_SYSTEM Or A_HIDDEN Or A_RDONLY)) & vbCrLf
strDisplay = strDisplay & "(A)rchive, (S)ystem, (H)idden, (R)ead-Only : " & cFilesInDirOnDisk(File1, File2, -(A_NORMAL Or A_SYSTEM Or A_HIDDEN Or A_RDONLY)) & vbCrLf
strDisplay = strDisplay & "(H)idden, (R)ead-Only : " & cFilesInDirOnDisk(File1, File2, -(A_HIDDEN Or A_RDONLY)) & vbCrLf
strDisplay = strDisplay & "(R)ead-Only : " & cFilesInDirOnDisk(File1, File2, -(A_RDONLY)) & vbCrLf
strDisplay = strDisplay & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFilesInDirOnDisk(File1, File2, A_ALL)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileDateTime()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
strDisplay = strDisplay & "File creation for '" & File1 & "' is " & cFileDateCreated(File1) & " " & cFileTimeCreated(File1) & vbCrLf
strDisplay = strDisplay & "File last access for '" & File1 & "' is " & cFileLastDateAccess(File1) & " " & cFileLastTimeAccess(File1) & vbCrLf
strDisplay = strDisplay & "File last modification for '" & File1 & "' is " & cFileLastDateModified(File1) & " " & cFileLastTimeModified(File1) & vbCrLf & vbCrLf
File1 = "c:\config.sys"
strDisplay = strDisplay & "File creation for '" & File1 & "' is " & cFileDateCreated(File1) & " " & cFileTimeCreated(File1) & vbCrLf
strDisplay = strDisplay & "File last access for '" & File1 & "' is " & cFileLastDateAccess(File1) & " " & cFileLastTimeAccess(File1) & vbCrLf
strDisplay = strDisplay & "File last modification for '" & File1 & "' is " & cFileLastDateModified(File1) & " " & cFileLastTimeModified(File1) & vbCrLf & vbCrLf
File1 = cGetSystemDirectory() + "\t2win-32.dll"
strDisplay = strDisplay & "File creation for '" & File1 & "' is " & cFileDateCreated(File1) & " " & cFileTimeCreated(File1) & vbCrLf
strDisplay = strDisplay & "File last access for '" & File1 & "' is " & cFileLastDateAccess(File1) & " " & cFileLastTimeAccess(File1) & vbCrLf
strDisplay = strDisplay & "File last modification for '" & File1 & "' is " & cFileLastDateModified(File1) & " " & cFileLastTimeModified(File1) & vbCrLf & vbCrLf
File1 = cGetWindowsDirectory() + "\user.dat"
strDisplay = strDisplay & "File creation for '" & File1 & "' is " & cFileDateCreated(File1) & " " & cFileTimeCreated(File1) & vbCrLf
strDisplay = strDisplay & "File last access for '" & File1 & "' is " & cFileLastDateAccess(File1) & " " & cFileLastTimeAccess(File1) & vbCrLf
strDisplay = strDisplay & "File last modification for '" & File1 & "' is " & cFileLastDateModified(File1) & " " & cFileLastTimeModified(File1) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cFileDateCreated(File1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileStatistics()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim nL As Long
Dim nW As Long
Dim nC As Long
Dim File1 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
strDisplay = strDisplay & "File statictics for '" & File1 & "' is " & cFileStatistics(File1, nL, nW, nC) & vbCrLf
strDisplay = strDisplay & "number of lines : " & nL & vbCrLf
strDisplay = strDisplay & "number of words : " & nW & vbCrLf
strDisplay = strDisplay & "number of chars : " & nC & vbCrLf & vbCrLf
File1 = "c:\config.sys"
strDisplay = strDisplay & "File statictics for '" & File1 & "' is " & cFileStatistics(File1, nL, nW, nC) & vbCrLf
strDisplay = strDisplay & "number of lines : " & nL & vbCrLf
strDisplay = strDisplay & "number of words : " & nW & vbCrLf
strDisplay = strDisplay & "number of chars : " & nC & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
File1 = "D:\Program Files\DevStudio\VB\Winapi\Win32api.txt"
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFileStatistics(File1, nL, nW, nC)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestGetDriveType()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
strResult = ""
strDisplay = ""
For i = 1 To 26
intResult = cGetDriveType(Chr$(64 + i))
If (intResult > 0) Then
strDisplay = strDisplay & "'" & Chr$(64 + i) & ":' is "
Select Case intResult
Case DRIVE_UNKNOWN
strDisplay = strDisplay & "(unknown)" & vbCrLf
Case DRIVE_NO_ROOT_DIR
strDisplay = strDisplay & "(not root dir)" & vbCrLf
Case DRIVE_REMOVABLE
strDisplay = strDisplay & "removable" & vbCrLf
Case DRIVE_FIXED
strDisplay = strDisplay & "fixed disk" & vbCrLf
Case DRIVE_REMOTE
strDisplay = strDisplay & "remote disk" & vbCrLf
Case DRIVE_CDROM
strDisplay = strDisplay & "cd-rom" & vbCrLf
Case DRIVE_RAMDISK
strDisplay = strDisplay & "ram disk" & vbCrLf
End Select
End If
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cGetDriveType("C")
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestPBFileCopy()
Dim intResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = cGetWindowsDirectory() + "\" + "system.dat"
File2 = "system.pbcopy"
strDisplay = strDisplay & "PB File Copy '" & File1 & "' to '" & File2 & "' is " & cPBFileCopy(Me.hWnd, File1, File2) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
DoEvents
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cPBFileCopy(Me.hWnd, File1, File2)
DoEvents
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestDBFileCopy()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = cGetWindowsDirectory() + "\" + "system.dat"
File2 = "system.dbcopy"
strDisplay = strDisplay & "DB File Copy '" & File1 & "' to '" & File2 & "' is " & cDBFileCopy("", "", "", "", File1, File2) & vbCrLf & vbCrLf
File1 = cGetWindowsDirectory() + "\" + "command.com"
File2 = "command.dbcopy"
strDisplay = strDisplay & "DB File Copy '" & File1 & "' to '" & File2 & "' is " & cDBFileCopy("", "", "", "", File1, File2) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
DoEvents
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cDBFileCopy("", "", "", "", File1, File2)
DoEvents
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileUUCP()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim File1 As String
Dim File2 As String
Dim File3 As String
strResult = ""
strDisplay = ""
File1 = cGetWindowsDirectory() & "\system.dat"
File2 = "system.uuencoded"
File3 = "system.uudecoded"
strDisplay = strDisplay & "File UUencode (without header) '" & File1 & "' to '" & File2 & "' is " & cFileUUCP(File1, File2, MODE_UUENCODE, False) & vbCrLf
strDisplay = strDisplay & "File UUdecode (without header) '" & File2 & "' to '" & File3 & "' is " & cFileUUCP(File2, File3, MODE_UUDECODE, False) & vbCrLf
strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
strDisplay = strDisplay & "File UUencode (with header) '" & File1 & "' to '" & File2 & "' is " & cFileUUCP(File1, File2, MODE_UUENCODE, True) & vbCrLf
strDisplay = strDisplay & "File UUdecode (with header) '" & File2 & "' to '" & File3 & "' is " & cFileUUCP(File2, File3, MODE_UUDECODE, True) & vbCrLf
strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
File1 = T2WFileTest
File2 = "autoexec.uuencoded"
File3 = "autoexec.uudecoded"
strDisplay = strDisplay & "File UUencode (without header) '" & File1 & "' to '" & File2 & "' is " & cFileUUCP(File1, File2, MODE_UUENCODE, False) & vbCrLf
strDisplay = strDisplay & "File UUdecode (without header) '" & File2 & "' to '" & File3 & "' is " & cFileUUCP(File2, File3, MODE_UUDECODE, False) & vbCrLf
strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
strDisplay = strDisplay & "File UUencode (with header) '" & File1 & "' to '" & File2 & "' is " & cFileUUCP(File1, File2, MODE_UUENCODE, True) & vbCrLf
strDisplay = strDisplay & "File UUdecode (with header) '" & File2 & "' to '" & File3 & "' is " & cFileUUCP(File2, File3, MODE_UUDECODE, True) & vbCrLf
strDisplay = strDisplay & "Compare File contents (not sensitive) '" & File1 & "' with '" & File3 & "' is " & IIf(cCmpFileContents(File1, File3, False) = -1, "same", "not same") & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFileUUCP(File1, File2, MODE_UUENCODE, True)
Next i
lResult = cFileUUCP(File2, File3, MODE_UUDECODE, True)
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestOpenFiles(Mode As Integer)
Dim intResult As Integer
Dim OpenFileName As String
Dim OpenFileMode As Long
Dim OpenFileType As Long
Dim strDisplay As String
Dim i As Long
strDisplay = ""
i = -1
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
intResult = cEnumOpenFiles("C", Mode, True, OpenFileName, OpenFileMode, OpenFileType)
strDisplay = "All open files on drive C are " & vbCrLf & vbCrLf
While (intResult = NO_ERROR_OPEN_FILES)
strDisplay = strDisplay + OpenFileName + " , " & OpenFileMode & " , " & OpenFileType & vbCrLf
intResult = cEnumOpenFiles("C", Mode, False, OpenFileName, OpenFileMode, OpenFileType)
Wend
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
txt_Result = strDisplay
End Sub
Private Sub TestSplitFile()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim n As Long
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = cGetSystemDirectory() + "\VBA2.DLL"
File2 = "vba2test"
strDisplay = strDisplay & "FileSize of '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
n = cSplitFile(File1, File2, cFileSize(File1) \ 7) - 1
strDisplay = strDisplay & "SplitFile '" & File1 & "' into part size of '" & (cFileSize(File1) \ 7) & "' bytes return '" & (n + 1) & "' file(s)" & vbCrLf & vbCrLf
For i = 0 To n
strResult = File2 & "." & Format$(i, "000")
strDisplay = strDisplay & "FileSize of '" & strResult & "' is " & cFileSize(strResult) & vbCrLf
Next i
strDisplay = strDisplay & vbCrLf
File1 = T2WFileTest
File2 = "autoexec"
strDisplay = strDisplay & "FileSize of '" & File1 & "' is " & cFileSize(File1) & vbCrLf & vbCrLf
n = cSplitFile(File1, File2, 257) - 1
strDisplay = strDisplay & "SplitFile '" & File1 & "' into part size of 257 bytes return '" & (n + 1) & "' file(s)" & vbCrLf & vbCrLf
For i = 0 To n
strResult = File2 & "." & Format$(i, "000")
strDisplay = strDisplay & "FileSize of '" & strResult & "' is " & cFileSize(strResult) & vbCrLf
Next i
strDisplay = strDisplay & vbCrLf
n = cSplitFile(File1, File2, 1025) - 1
strDisplay = strDisplay & "SplitFile '" & File1 & "' into part size of 1025 bytes return '" & (n + 1) & "' file(s)" & vbCrLf & vbCrLf
For i = 0 To n
strResult = File2 & "." & Format$(i, "000")
strDisplay = strDisplay & "FileSize of '" & strResult & "' is " & cFileSize(strResult) & vbCrLf
Next i
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cSplitFile(File1, File2, 257)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestCutFile()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim n As Long
Dim File1 As String
Dim File2 As String
Dim File3 As String
strResult = ""
strDisplay = ""
File1 = cGetSystemDirectory() + "\VBA2.DLL"
File2 = "vba2test.cut1"
File3 = "vba2test.cut2"
n = cFileSize(File1) * 1 / 4
strDisplay = strDisplay & "CutFile '" & File1 & "' at position '" & n & "' to '" & File2 & "' and '" & File3 & "' is " & cCutFile(File1, File2, File3, n) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File1 & "' is " & cFileSize(File1) & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File2 & "' is " & cFileSize(File2) & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File3 & "' is " & cFileSize(File3) & vbCrLf
strDisplay = strDisplay & vbCrLf
File1 = T2WFileTest
File2 = "autoexec.cut1"
File3 = "autoexec.cut2"
n = cFileSize(File1) * 1 \ 4
strDisplay = strDisplay & "CutFile '" & File1 & "' at position '" & n & "' to '" & File2 & "' and '" & File3 & "' is " & cCutFile(File1, File2, File3, n) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File1 & "' is " & cFileSize(File1) & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File2 & "' is " & cFileSize(File2) & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File3 & "' is " & cFileSize(File3) & vbCrLf
strDisplay = strDisplay & vbCrLf
n = cFileSize(File1) * 3 \ 4
strDisplay = strDisplay & "CutFile '" & File1 & "' at position '" & n & "' to '" & File2 & "' and '" & File3 & "' is " & cCutFile(File1, File2, File3, n) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File1 & "' is " & cFileSize(File1) & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File2 & "' is " & cFileSize(File2) & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File3 & "' is " & cFileSize(File3) & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cCutFile(File1, File2, File3, n)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestGetFileDateTime()
Dim intResult As Integer
Dim strDisplay As String
Dim SysCreation As tagSYSTEMTIME
Dim SysLastAccess As tagSYSTEMTIME
Dim SysLastWrite As tagSYSTEMTIME
Dim i As Integer
Dim File1 As String
strDisplay = ""
File1 = T2WFileTest
strDisplay = strDisplay & "File '" & File1 & "'" & vbCrLf
intResult = cGetFileDateTime(File1, SysCreation, SysLastAccess, SysLastWrite)
If (intResult <> True) Then
strDisplay = strDisplay & " Can't get date & time information (error : " & intResult & ")" & vbCrLf & vbCrLf
Else
strDisplay = strDisplay & " Creation : " & Format$(DateSerial(SysCreation.wYear, SysCreation.wMonth, SysCreation.wDay), "short date") & " " & Format$(TimeSerial(SysCreation.wHour, SysCreation.wMinute, SysCreation.wSecond), "hh:mm:ss") & vbCrLf
strDisplay = strDisplay & " Last Access : " & Format$(DateSerial(SysLastAccess.wYear, SysLastAccess.wMonth, SysLastAccess.wDay), "short date") & " " & Format$(TimeSerial(SysLastAccess.wHour, SysLastAccess.wMinute, SysLastAccess.wSecond), "hh:mm:ss") & vbCrLf
strDisplay = strDisplay & " Last Write : " & Format$(DateSerial(SysLastWrite.wYear, SysLastWrite.wMonth, SysLastWrite.wDay), "short date") & " " & Format$(TimeSerial(SysLastWrite.wHour, SysLastWrite.wMinute, SysLastWrite.wSecond), "hh:mm:ss") & vbCrLf & vbCrLf
End If
File1 = "c:\config.sys"
strDisplay = strDisplay & "File '" & File1 & "'" & vbCrLf
intResult = cGetFileDateTime(File1, SysCreation, SysLastAccess, SysLastWrite)
If (intResult <> True) Then
strDisplay = strDisplay & " Can't get date & time information (error : " & intResult & ")" & vbCrLf & vbCrLf
Else
strDisplay = strDisplay & " Creation : " & Format$(DateSerial(SysCreation.wYear, SysCreation.wMonth, SysCreation.wDay), "short date") & " " & Format$(TimeSerial(SysCreation.wHour, SysCreation.wMinute, SysCreation.wSecond), "hh:mm:ss") & vbCrLf
strDisplay = strDisplay & " Last Access : " & Format$(DateSerial(SysLastAccess.wYear, SysLastAccess.wMonth, SysLastAccess.wDay), "short date") & " " & Format$(TimeSerial(SysLastAccess.wHour, SysLastAccess.wMinute, SysLastAccess.wSecond), "hh:mm:ss") & vbCrLf
strDisplay = strDisplay & " Last Write : " & Format$(DateSerial(SysLastWrite.wYear, SysLastWrite.wMonth, SysLastWrite.wDay), "short date") & " " & Format$(TimeSerial(SysLastWrite.wHour, SysLastWrite.wMinute, SysLastWrite.wSecond), "hh:mm:ss") & vbCrLf & vbCrLf
End If
File1 = cGetSystemDirectory() + "\t2win-32.dll"
strDisplay = strDisplay & "File '" & File1 & "'" & vbCrLf
intResult = cGetFileDateTime(File1, SysCreation, SysLastAccess, SysLastWrite)
If (intResult <> True) Then
strDisplay = strDisplay & " Can't get date & time information (error : " & intResult & ")" & vbCrLf & vbCrLf
Else
strDisplay = strDisplay & " Creation : " & Format$(DateSerial(SysCreation.wYear, SysCreation.wMonth, SysCreation.wDay), "short date") & " " & Format$(TimeSerial(SysCreation.wHour, SysCreation.wMinute, SysCreation.wSecond), "hh:mm:ss") & vbCrLf
strDisplay = strDisplay & " Last Access : " & Format$(DateSerial(SysLastAccess.wYear, SysLastAccess.wMonth, SysLastAccess.wDay), "short date") & " " & Format$(TimeSerial(SysLastAccess.wHour, SysLastAccess.wMinute, SysLastAccess.wSecond), "hh:mm:ss") & vbCrLf
strDisplay = strDisplay & " Last Write : " & Format$(DateSerial(SysLastWrite.wYear, SysLastWrite.wMonth, SysLastWrite.wDay), "short date") & " " & Format$(TimeSerial(SysLastWrite.wHour, SysLastWrite.wMinute, SysLastWrite.wSecond), "hh:mm:ss") & vbCrLf & vbCrLf
End If
File1 = cGetWindowsDirectory() + "\user.dat"
strDisplay = strDisplay & "File '" & File1 & "'" & vbCrLf
intResult = cGetFileDateTime(File1, SysCreation, SysLastAccess, SysLastWrite)
If (intResult <> True) Then
strDisplay = strDisplay & " Can't get date & time information (error : " & intResult & ")" & vbCrLf & vbCrLf
Else
strDisplay = strDisplay & " Creation : " & Format$(DateSerial(SysCreation.wYear, SysCreation.wMonth, SysCreation.wDay), "short date") & " " & Format$(TimeSerial(SysCreation.wHour, SysCreation.wMinute, SysCreation.wSecond), "hh:mm:ss") & vbCrLf
strDisplay = strDisplay & " Last Access : " & Format$(DateSerial(SysLastAccess.wYear, SysLastAccess.wMonth, SysLastAccess.wDay), "short date") & " " & Format$(TimeSerial(SysLastAccess.wHour, SysLastAccess.wMinute, SysLastAccess.wSecond), "hh:mm:ss") & vbCrLf
strDisplay = strDisplay & " Last Write : " & Format$(DateSerial(SysLastWrite.wYear, SysLastWrite.wMonth, SysLastWrite.wDay), "short date") & " " & Format$(TimeSerial(SysLastWrite.wHour, SysLastWrite.wMinute, SysLastWrite.wSecond), "hh:mm:ss") & vbCrLf & vbCrLf
End If
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cGetFileDateTime(File1, SysCreation, SysLastAccess, SysLastWrite)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestSetFileDateTime()
Dim intResult As Integer
Dim strDisplay As String
Dim SysCreation As tagSYSTEMTIME
Dim SysLastAccess As tagSYSTEMTIME
Dim SysLastWrite As tagSYSTEMTIME
Dim BckSysCreation As tagSYSTEMTIME
Dim BckSysLastAccess As tagSYSTEMTIME
Dim BckSysLastWrite As tagSYSTEMTIME
Dim i As Integer
Dim File1 As String
strDisplay = ""
File1 = T2WFileTest
strDisplay = strDisplay & "Get date & time information for file '" & File1 & "'" & vbCrLf
intResult = cGetFileDateTime(File1, SysCreation, SysLastAccess, SysLastWrite)
If (intResult <> True) Then
strDisplay = strDisplay & " Can't get date & time information (error : " & intResult & ")" & vbCrLf & vbCrLf
Else
strDisplay = strDisplay & " Creation : " & Format$(DateSerial(SysCreation.wYear, SysCreation.wMonth, SysCreation.wDay), "short date") & " " & Format$(TimeSerial(SysCreation.wHour, SysCreation.wMinute, SysCreation.wSecond), "hh:mm:ss") & vbCrLf
strDisplay = strDisplay & " Last Access : " & Format$(DateSerial(SysLastAccess.wYear, SysLastAccess.wMonth, SysLastAccess.wDay), "short date") & " " & Format$(TimeSerial(SysLastAccess.wHour, SysLastAccess.wMinute, SysLastAccess.wSecond), "hh:mm:ss") & vbCrLf
strDisplay = strDisplay & " Last Write : " & Format$(DateSerial(SysLastWrite.wYear, SysLastWrite.wMonth, SysLastWrite.wDay), "short date") & " " & Format$(TimeSerial(SysLastWrite.wHour, SysLastWrite.wMinute, SysLastWrite.wSecond), "hh:mm:ss") & vbCrLf & vbCrLf
End If
Call cTypesCopy(SysCreation, BckSysCreation, Len(SysCreation))
Call cTypesCopy(SysLastAccess, BckSysLastAccess, Len(SysLastAccess))
Call cTypesCopy(SysLastWrite, BckSysLastWrite, Len(SysLastWrite))
strDisplay = strDisplay & "Set actual date & time information for file '" & File1 & "'" & vbCrLf & vbCrLf
SysCreation.wYear = Year(Now())
SysCreation.wMonth = Month(Now())
SysCreation.wDay = Day(Now())
SysCreation.wHour = 23 'Hour(Now())
SysCreation.wMinute = 0 'Minute(Now())
SysCreation.wSecond = 0 'Second(Now())
Call cTypesCopy(SysCreation, SysLastAccess, Len(SysCreation))
Call cTypesCopy(SysCreation, SysLastWrite, Len(SysCreation))
intResult = cSetFileDateTime(File1, SysCreation, SysLastAccess, SysLastWrite)
If (intResult <> True) Then
strDisplay = strDisplay & " Can't set date & time information (error : " & intResult & ")" & vbCrLf & vbCrLf
Else
strDisplay = strDisplay & " Get actual date & time information for file '" & File1 & "'" & vbCrLf
intResult = cGetFileDateTime(File1, SysCreation, SysLastAccess, SysLastWrite)
If (intResult <> True) Then
strDisplay = strDisplay & " Can't get date & time information (error : " & intResult & ")" & vbCrLf & vbCrLf
Else
strDisplay = strDisplay & " Creation : " & Format$(DateSerial(SysCreation.wYear, SysCreation.wMonth, SysCreation.wDay), "short date") & " " & Format$(TimeSerial(SysCreation.wHour, SysCreation.wMinute, SysCreation.wSecond), "hh:mm:ss") & vbCrLf
strDisplay = strDisplay & " Last Access : " & Format$(DateSerial(SysLastAccess.wYear, SysLastAccess.wMonth, SysLastAccess.wDay), "short date") & " " & Format$(TimeSerial(SysLastAccess.wHour, SysLastAccess.wMinute, SysLastAccess.wSecond), "hh:mm:ss") & vbCrLf
strDisplay = strDisplay & " Last Write : " & Format$(DateSerial(SysLastWrite.wYear, SysLastWrite.wMonth, SysLastWrite.wDay), "short date") & " " & Format$(TimeSerial(SysLastWrite.wHour, SysLastWrite.wMinute, SysLastWrite.wSecond), "hh:mm:ss") & vbCrLf & vbCrLf
End If
End If
strDisplay = strDisplay & "Restore date & time information for file '" & File1 & "'" & vbCrLf & vbCrLf
intResult = cSetFileDateTime(File1, BckSysCreation, BckSysLastAccess, BckSysLastWrite)
If (intResult <> True) Then
strDisplay = strDisplay & " Can't restore date & time information (error : " & intResult & ")" & vbCrLf & vbCrLf
Else
strDisplay = strDisplay & " Get actual date & time information for file '" & File1 & "'" & vbCrLf
intResult = cGetFileDateTime(File1, SysCreation, SysLastAccess, SysLastWrite)
If (intResult <> True) Then
strDisplay = strDisplay & " Can't get date & time information (error : " & intResult & ")" & vbCrLf & vbCrLf
Else
strDisplay = strDisplay & " Creation : " & Format$(DateSerial(SysCreation.wYear, SysCreation.wMonth, SysCreation.wDay), "short date") & " " & Format$(TimeSerial(SysCreation.wHour, SysCreation.wMinute, SysCreation.wSecond), "hh:mm:ss") & vbCrLf
strDisplay = strDisplay & " Last Access : " & Format$(DateSerial(SysLastAccess.wYear, SysLastAccess.wMonth, SysLastAccess.wDay), "short date") & " " & Format$(TimeSerial(SysLastAccess.wHour, SysLastAccess.wMinute, SysLastAccess.wSecond), "hh:mm:ss") & vbCrLf
strDisplay = strDisplay & " Last Write : " & Format$(DateSerial(SysLastWrite.wYear, SysLastWrite.wMonth, SysLastWrite.wDay), "short date") & " " & Format$(TimeSerial(SysLastWrite.wHour, SysLastWrite.wMinute, SysLastWrite.wSecond), "hh:mm:ss") & vbCrLf & vbCrLf
End If
End If
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cSetFileDateTime(File1, BckSysCreation, BckSysLastAccess, BckSysLastWrite)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileMergeExt()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim TargetFile As String
strResult = ""
strDisplay = ""
ReDim FileArray(1 To 7) As String
For i = 1 To 7
FileArray(i) = Space$(256)
Next i
TargetFile = "autoexec.mergedext"
strDisplay = strDisplay & "Prepare file array (code : " & cFilesInDirToArray("c:\*.*", A_ALL, FileArray()) & ")" & vbCrLf & vbCrLf
strDisplay = strDisplay & "Merge the following 7 files : " & vbCrLf
For i = 1 To 7
FileArray(i) = "c:\" & FileArray(i)
strDisplay = strDisplay & " " & FileArray(i) & " (size : " & cFileSize(FileArray(i)) & ")" & vbCrLf
Next i
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "Result is " & cFileMergeExt(FileArray(), TargetFile) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFileMergeExt(FileArray(), TargetFile)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestGetFileTypeName()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim Tmp As String
Dim i As Long
strResult = ""
strDisplay = ""
ReDim FileArray(1 To 25) As String
For i = 1 To 25
FileArray(i) = Space$(256)
Next i
Tmp = cGetWindowsDirectory()
intResult = cFilesInDirToArray(Tmp & "\*.*", A_ALL, FileArray())
strDisplay = strDisplay & "Type Name of the 25 following files is : " & vbCrLf & vbCrLf
For i = 1 To 25
FileArray(i) = Tmp & "\" & FileArray(i)
strDisplay = strDisplay & " " & FileArray(i) & " -> " & cGetFileTypeName(FileArray(i)) & vbCrLf
Next i
strDisplay = strDisplay & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cGetFileTypeName(FileArray(1))
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestShortCutFile()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim Tmp As String
ReDim shortcutfile(1 To 2) As String
Dim Description As String
Dim i As Long
Dim j As Long
strResult = ""
strDisplay = ""
Tmp = cGetWindowsDirectory()
i = cSearchFile(Tmp, "*.lnk", T2WDirTest & "\search.log")
If (i <= 0) Then
strDisplay = "no ShortCut Files found in " & Tmp & " and sub-directories" & vbCrLf
Else
Close #1
Open T2WDirTest & "\search.log" For Input Shared As #1
Line Input #1, shortcutfile(1)
Line Input #1, shortcutfile(2)
Close #1
For i = 1 To 2
strDisplay = strDisplay & "ShortCut File is " & shortcutfile(i) & vbCrLf
Description = cShortcutFileGetDescription(shortcutfile(i))
strDisplay = strDisplay & " Current Path : " & cShortcutFileGetPath(shortcutfile(i)) & vbCrLf
strDisplay = strDisplay & " Current Path83 : " & cShortcutFileGetPath83(shortcutfile(i)) & vbCrLf
strDisplay = strDisplay & " Current Work Dir : " & cShortcutFileGetWorkingDir(shortcutfile(i)) & vbCrLf
strDisplay = strDisplay & " Current Description : " & cShortcutFileGetDescription(shortcutfile(i)) & vbCrLf
strDisplay = strDisplay & " Current Arguments : " & cShortcutFileGetArguments(shortcutfile(i)) & vbCrLf & vbCrLf
intResult = cShortcutFileSetDescription(shortcutfile(i), "this is a new description")
strDisplay = strDisplay & " Modify description to '" & cShortcutFileGetDescription(shortcutfile(i)) & "'" & vbCrLf
strDisplay = strDisplay & " Current Description : " & cShortcutFileGetDescription(shortcutfile(i)) & vbCrLf
intResult = cShortcutFileSetDescription(shortcutfile(i), Description)
strDisplay = strDisplay & " Restore description to '" & cShortcutFileGetDescription(shortcutfile(i)) & "'" & vbCrLf
strDisplay = strDisplay & " Current Description : " & cShortcutFileGetDescription(shortcutfile(i)) & vbCrLf & vbCrLf
strDisplay = strDisplay & " get information by ID" & vbCrLf
For j = SHORTCUTFILE_GETPATH To SHORTCUTFILE_GETARGUMENTS
strDisplay = strDisplay & " ID " & j & " : " & cShortcutFileGetInfo(shortcutfile(i), j) & vbCrLf
Next j
strDisplay = strDisplay & vbCrLf
Next i
End If
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cShortcutFileGetInfo(shortcutfile(1), 1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestGetFileDisplayName()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim Tmp As String
Dim i As Long
strResult = ""
strDisplay = ""
ReDim FileArray(1 To 25) As String
For i = 1 To 25
FileArray(i) = Space$(256)
Next i
Tmp = cGetWindowsDirectory()
intResult = cFilesInDirToArray(Tmp & "\*.*", A_ALL, FileArray())
strDisplay = strDisplay & "Display Name of the 25 following files is : " & vbCrLf & vbCrLf
For i = 1 To 25
FileArray(i) = Tmp & "\" & FileArray(i)
strDisplay = strDisplay & " " & FileArray(i) & " -> " & cGetFileDisplayName(FileArray(i)) & vbCrLf
Next i
strDisplay = strDisplay & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cGetFileTypeName(FileArray(1))
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFilesCopy()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim SrcPath As String
Dim DstPath As String
Dim CopyPattern As String
Dim Flags As Integer
strResult = ""
strDisplay = ""
SrcPath = cGetWindowsDirectory()
DstPath = T2WDirTest
CopyPattern = "*.INI"
'strDisplay = strDisplay & "Common option FC_FORCE_COPY" & vbCrLf & vbCrLf
Flags = 0
lResult = cFilesCopy(SrcPath, DstPath, CopyPattern, Flags)
strDisplay = strDisplay & "Files Copy '" & CopyPattern & "'" & vbCrLf
strDisplay = strDisplay & " with no extra option" & vbCrLf
strDisplay = strDisplay & " from '" & SrcPath & "'" & vbCrLf
strDisplay = strDisplay & " to '" & DstPath & "'" & vbCrLf
strDisplay = strDisplay & " is " & lResult & vbCrLf & vbCrLf
Flags = FC_OVERWRITE_EXISTING
lResult = cFilesCopy(SrcPath, DstPath, CopyPattern, Flags)
strDisplay = strDisplay & "Files Copy '" & CopyPattern & "'" & vbCrLf
strDisplay = strDisplay & " with option FC_OVERWRITE_EXISTING" & vbCrLf
strDisplay = strDisplay & " from '" & SrcPath & "'" & vbCrLf
strDisplay = strDisplay & " to '" & DstPath & "'" & vbCrLf
strDisplay = strDisplay & " is " & lResult & vbCrLf & vbCrLf
Flags = FC_OVERWRITE_EXISTING Or FC_INCLUDE_SUB_DIRECTORY
lResult = cFilesCopy(SrcPath, DstPath, CopyPattern, Flags)
strDisplay = strDisplay & "Files Copy '" & CopyPattern & "'" & vbCrLf
strDisplay = strDisplay & " with option FC_OVERWRITE_EXISTING and FC_INCLUDE_SUB_DIRECTORY" & vbCrLf
strDisplay = strDisplay & " from '" & SrcPath & "'" & vbCrLf
strDisplay = strDisplay & " to '" & DstPath & "'" & vbCrLf
strDisplay = strDisplay & " is " & lResult & vbCrLf & vbCrLf
Flags = FC_OVERWRITE_EXISTING Or FC_INCLUDE_SUB_DIRECTORY Or FC_DONT_COPY_EMPTY_DIRECTORY
lResult = cFilesCopy(SrcPath, DstPath, CopyPattern, Flags)
strDisplay = strDisplay & "Files Copy '" & CopyPattern & "'" & vbCrLf
strDisplay = strDisplay & " with option FC_OVERWRITE_EXISTING and FC_INCLUDE_SUB_DIRECTORY and FC_DONT_COPY_EMPTY_DIRECTORY" & vbCrLf
strDisplay = strDisplay & " from '" & SrcPath & "'" & vbCrLf
strDisplay = strDisplay & " to '" & DstPath & "'" & vbCrLf
strDisplay = strDisplay & " is " & lResult & vbCrLf & vbCrLf
Flags = 0
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFilesCopy(SrcPath, DstPath, CopyPattern, Flags)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFilesCopyExt()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim SrcPath As String
Dim DstPath As String
Dim CopyPattern As String
Dim Flags As Integer
strResult = ""
strDisplay = ""
SrcPath = cGetWindowsDirectory()
DstPath = T2WDirTest
CopyPattern = "*.ini"
Flags = FC_DISPLAY_2_LINES
lResult = cFilesCopyExt(lblProgress, SrcPath, DstPath, CopyPattern, Flags)
strDisplay = strDisplay & "Files Copy Ext '" & CopyPattern & "'" & vbCrLf
strDisplay = strDisplay & " with no option" & vbCrLf
strDisplay = strDisplay & " from '" & SrcPath & "'" & vbCrLf
strDisplay = strDisplay & " to '" & DstPath & "'" & vbCrLf
strDisplay = strDisplay & " is " & lResult & vbCrLf & vbCrLf
Flags = FC_OVERWRITE_EXISTING Or FC_DISPLAY_2_LINES
lResult = cFilesCopyExt(lblProgress, SrcPath, DstPath, CopyPattern, Flags)
strDisplay = strDisplay & "Files Copy Ext '" & CopyPattern & "'" & vbCrLf
strDisplay = strDisplay & " with option FC_OVERWRITE_EXISTING" & vbCrLf
strDisplay = strDisplay & " from '" & SrcPath & "'" & vbCrLf
strDisplay = strDisplay & " to '" & DstPath & "'" & vbCrLf
strDisplay = strDisplay & " is " & lResult & vbCrLf & vbCrLf
Flags = FC_OVERWRITE_EXISTING Or FC_INCLUDE_SUB_DIRECTORY Or FC_DISPLAY_2_LINES
lResult = cFilesCopyExt(lblProgress, SrcPath, DstPath, CopyPattern, Flags)
strDisplay = strDisplay & "Files Copy Ext '" & CopyPattern & "'" & vbCrLf
strDisplay = strDisplay & " with option FC_OVERWRITE_EXISTING and FC_INCLUDE_SUB_DIRECTORY" & vbCrLf
strDisplay = strDisplay & " from '" & SrcPath & "'" & vbCrLf
strDisplay = strDisplay & " to '" & DstPath & "'" & vbCrLf
strDisplay = strDisplay & " is " & lResult & vbCrLf & vbCrLf
Flags = 0
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFilesCopyExt(lblProgress, SrcPath, DstPath, CopyPattern, Flags)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileLineCount2()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim File2 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
strDisplay = strDisplay & "Total lines in '" & File1 & "' are " & cFileLineCount2(File1) & vbCrLf & vbCrLf
File1 = "c:\autoexec.bat"
strDisplay = strDisplay & "Total lines in '" & File1 & "' are " & cFileLineCount2(File1) & vbCrLf & vbCrLf
File1 = "c:\config.sys"
strDisplay = strDisplay & "Total lines in '" & File1 & "' are " & cFileLineCount2(File1) & vbCrLf & vbCrLf
File1 = "c:\test.tst"
strDisplay = strDisplay & "Total lines in '" & File1 & "' are " & cFileLineCount2(File1) & vbCrLf & vbCrLf
File1 = "c:\command.com"
strDisplay = strDisplay & "Total lines in '" & File1 & "' are " & cFileLineCount2(File1) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
File1 = "D:\Program Files\DevStudio\VB\Winapi\Win32api.txt"
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFileLineCount2(File1)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Public Sub TestFileSearchFromLine()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim Search1 As String
Dim Search2 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
Search1 = "re"
Search2 = "SET"
lResult = 0
strDisplay = strDisplay & "File Search (first line occurence, insensitive) : '" & Search1 & "' in '" & File1 & "' is" & vbCrLf
strResult = cFileSearchFromLine(File1, Search1, lResult, False)
strDisplay = strDisplay & " line (" & lResult & ") : " & strResult & vbCrLf
lResult = 0
strDisplay = strDisplay & "File Search (first line occurence, insensitive) : '" & Search2 & "' in '" & File1 & "' is" & vbCrLf
strResult = cFileSearchFromLine(File1, Search2, lResult, False)
strDisplay = strDisplay & " line (" & lResult & ") : " & strResult & vbCrLf & vbCrLf
lResult = 0
strDisplay = strDisplay & "File Search (first line occurence, sensitive) : '" & Search1 & "' in '" & File1 & "' is" & vbCrLf
strResult = cFileSearchFromLine(File1, Search1, lResult, True)
strDisplay = strDisplay & " line (" & lResult & ") : " & strResult & vbCrLf
lResult = 0
strDisplay = strDisplay & "File Search (first line occurence, sensitive) : '" & Search2 & "' in '" & File1 & "' is" & vbCrLf
strResult = cFileSearchFromLine(File1, Search2, lResult, True)
strDisplay = strDisplay & " line (" & lResult & ") : " & strResult & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search (all lines occurence, insensitive) : '" & Search1 & "' in '" & File1 & "' is " & vbCrLf
lResult = 0
strResult = cFileSearchFromLine(File1, Search1, lResult, False)
While (lResult > 0)
strDisplay = strDisplay & " line (" & lResult & ") : " & strResult & vbCrLf
strResult = cFileSearchFromLine(File1, Search1, lResult, False)
Wend
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "File Search (all lines occurence, sensitive) : '" & Search1 & "' in '" & File1 & "' is " & vbCrLf
lResult = 0
strResult = cFileSearchFromLine(File1, Search1, lResult, True)
While (lResult > 0)
strDisplay = strDisplay & " line (" & lResult & ") : " & strResult & vbCrLf
strResult = cFileSearchFromLine(File1, Search1, lResult, True)
Wend
strDisplay = strDisplay & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cFileSearchFromLine(File1, Search1, lResult, False)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Public Sub TestFileSearchPatternFromLine()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim File1 As String
Dim Search1 As String
Dim Search2 As String
strResult = ""
strDisplay = ""
File1 = T2WFileTest
Search1 = "*r?m*"
Search2 = "*S[A-Z]T*"
lResult = 0
strDisplay = strDisplay & "File Search Pattern (first line occurence, insensitive) : '" & Search1 & "' in '" & File1 & "' is" & vbCrLf
strResult = cFileSearchPatternFromLine(File1, Search1, lResult, False)
strDisplay = strDisplay & " line (" & lResult & ") : " & strResult & vbCrLf
lResult = 0
strDisplay = strDisplay & "File Search Pattern (first line occurence, insensitive) : '" & Search2 & "' in '" & File1 & "' is" & vbCrLf
strResult = cFileSearchPatternFromLine(File1, Search2, lResult, False)
strDisplay = strDisplay & " line (" & lResult & ") : " & strResult & vbCrLf & vbCrLf
lResult = 0
strDisplay = strDisplay & "File Search Pattern (first line occurence, sensitive) : '" & Search1 & "' in '" & File1 & "' is" & vbCrLf
strResult = cFileSearchPatternFromLine(File1, Search1, lResult, True)
strDisplay = strDisplay & " line (" & lResult & ") : " & strResult & vbCrLf
lResult = 0
strDisplay = strDisplay & "File Search Pattern (first line occurence, sensitive) : '" & Search2 & "' in '" & File1 & "' is" & vbCrLf
strResult = cFileSearchPatternFromLine(File1, Search2, lResult, True)
strDisplay = strDisplay & " line (" & lResult & ") : " & strResult & vbCrLf & vbCrLf
strDisplay = strDisplay & "File Search Pattern (all lines occurence, insensitive) : '" & Search1 & "' in '" & File1 & "' is " & vbCrLf
lResult = 0
strResult = cFileSearchPatternFromLine(File1, Search1, lResult, False)
While (lResult > 0)
strDisplay = strDisplay & " line (" & lResult & ") : " & strResult & vbCrLf
strResult = cFileSearchPatternFromLine(File1, Search1, lResult, False)
Wend
strDisplay = strDisplay & vbCrLf
strDisplay = strDisplay & "File Search Pattern (all lines occurence, sensitive) : '" & Search1 & "' in '" & File1 & "' is " & vbCrLf
lResult = 0
strResult = cFileSearchPatternFromLine(File1, Search1, lResult, True)
While (lResult > 0)
strDisplay = strDisplay & " line (" & lResult & ") : " & strResult & vbCrLf
strResult = cFileSearchPatternFromLine(File1, Search1, lResult, True)
Wend
strDisplay = strDisplay & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cFileSearchPatternFromLine(File1, Search1, lResult, False)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFilePartAppend()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim n As Long
Dim File1 As String
Dim File2 As String
Dim File3 As String
strResult = ""
strDisplay = ""
File1 = cGetSystemDirectory() + "\VBA2.DLL"
File2 = "vba2test.cut1"
File3 = "vba2test.cut2"
n = cFileSize(File1) * 1 / 4
strDisplay = strDisplay & "FilePartAppend (part 1) '" & File1 & "' to position '" & n & "' to '" & File2 & "' is " & cFilePartAppend(File1, File2, n, True) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FilePartAppend (part 2) '" & File1 & "' to position '" & n & "' to '" & File2 & "' is " & cFilePartAppend(File1, File2, n, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File1 & "' is " & cFileSize(File1) & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File2 & "' is " & cFileSize(File2) & vbCrLf
strDisplay = strDisplay & vbCrLf
File1 = T2WFileTest
File2 = "autoexec.cut1"
File3 = "autoexec.cut2"
n = cFileSize(File1) * 1 \ 4
strDisplay = strDisplay & "FilePartAppend (part 1) '" & File1 & "' to position '" & n & "' to '" & File2 & "' is " & cFilePartAppend(File1, File2, n, True) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FilePartAppend (part 2) '" & File1 & "' to position '" & n & "' to '" & File2 & "' is " & cFilePartAppend(File1, File2, n, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File1 & "' is " & cFileSize(File1) & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File2 & "' is " & cFileSize(File2) & vbCrLf
strDisplay = strDisplay & vbCrLf
n = cFileSize(File1) * 3 \ 4
strDisplay = strDisplay & "FilePartAppend (part 1) '" & File1 & "' to position '" & n & "' to '" & File2 & "' is " & cFilePartAppend(File1, File2, n, True) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FilePartAppend (part 2) '" & File1 & "' to position '" & n & "' to '" & File2 & "' is " & cFilePartAppend(File1, File2, n, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File1 & "' is " & cFileSize(File1) & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File2 & "' is " & cFileSize(File2) & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFilePartAppend(File1, File2, n, True)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFilePartCopy()
Dim lResult As Long
Dim strResult As String
Dim strDisplay As String
Dim i As Long
Dim n As Long
Dim File1 As String
Dim File2 As String
Dim File3 As String
strResult = ""
strDisplay = ""
File1 = cGetSystemDirectory() + "\VBA2.DLL"
File2 = "vba2test.cut1"
File3 = "vba2test.cut2"
n = cFileSize(File1) * 1 / 4
strDisplay = strDisplay & "FilePartCopy (part 1) '" & File1 & "' to position '" & n & "' to '" & File2 & "' is " & cFilePartCopy(File1, File2, n, True) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FilePartCopy (part 2) '" & File1 & "' from position '" & n & "' to '" & File3 & "' is " & cFilePartCopy(File1, File3, n, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File1 & "' is " & cFileSize(File1) & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File2 & "' is " & cFileSize(File2) & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File3 & "' is " & cFileSize(File3) & vbCrLf
strDisplay = strDisplay & vbCrLf
File1 = T2WFileTest
File2 = "autoexec.cut1"
File3 = "autoexec.cut2"
n = cFileSize(File1) * 1 \ 4
strDisplay = strDisplay & "FilePartCopy (part 1) '" & File1 & "' to position '" & n & "' to '" & File2 & "' is " & cFilePartCopy(File1, File2, n, True) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FilePartCopy (part 2) '" & File1 & "' from position '" & n & "' to '" & File3 & "' is " & cFilePartCopy(File1, File3, n, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File1 & "' is " & cFileSize(File1) & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File2 & "' is " & cFileSize(File2) & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File3 & "' is " & cFileSize(File3) & vbCrLf
strDisplay = strDisplay & vbCrLf
n = cFileSize(File1) * 3 \ 4
strDisplay = strDisplay & "FilePartCopy (part 1) '" & File1 & "' to position '" & n & "' to '" & File2 & "' is " & cFilePartCopy(File1, File2, n, True) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FilePartCopy (part 2) '" & File1 & "' from position '" & n & "' to '" & File3 & "' is " & cFilePartCopy(File1, File3, n, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File1 & "' is " & cFileSize(File1) & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File2 & "' is " & cFileSize(File2) & vbCrLf
strDisplay = strDisplay & "FileSize of '" & File3 & "' is " & cFileSize(File3) & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
lResult = cFilePartCopy(File1, File2, n, True)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileScanHeader()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim Str1 As String
Dim Str2 As String
Dim File1 As String
intResult = 0
strResult = ""
strDisplay = ""
File1 = "scanheader.test"
Str1 = Str1 + "From: " + Chr$(34) + "Michael" + Chr$(34) + " <alpouda@kagi.com>" & vbCrLf
Str1 = Str1 + "To: " + Chr$(34) + "Michael" + Chr$(34) + " <alpouda@kagi.com>," & vbCrLf
Str1 = Str1 + " <alpha@pi.edu>," & vbCrLf
Str1 = Str1 + " " + Chr$(34) + "beta" + Chr$(34) + " <beta@pi.edu>," & vbCrLf
Str1 = Str1 + " " + Chr$(34) + "theta" + Chr$(34) & vbCrLf
Str1 = Str1 + "Cc: " + Chr$(34) + "gamma" + Chr$(34) + " <gamma@pi.edu>," & vbCrLf
Str1 = Str1 + " " + Chr$(34) + "rho" + Chr$(34) + " <rho@pi.edu>" & vbCrLf
Str1 = Str1 + "Bcc: " + Chr$(34) + "Michael" + Chr$(34) + " <alpouda@kagi.com>," & vbCrLf
Str1 = Str1 + " " + Chr$(34) + "test" + Chr$(34) + " <test@pi.edu>" & vbCrLf
Str1 = Str1 + "Subject: message Subject" & vbCrLf
Str1 = Str1 + "Date: Sun, 07 Apr 1998 07:07:07 +0200" & vbCrLf
Str1 = Str1 + "MIME-Version: 1.0" & vbCrLf
Str1 = Str1 + "Content-Type: text/plain;" & vbCrLf
Str1 = Str1 + "CharSet = " + Chr$(34) + "iso-8859-1" + Chr$(34) + "" & vbCrLf
Str1 = Str1 + "Content-Transfer-Encoding: 7bit" & vbCrLf
Str1 = Str1 + "X-Priority: 3" & vbCrLf
Str1 = Str1 + "X-MSMail - Priority: Normal" & vbCrLf
Str1 = Str1 + "X-Unsent: 1" & vbCrLf
Str1 = Str1 + "" & vbCrLf
Str1 = Str1 + "This is a test message." & vbCrLf
Str1 = Str1 + "" & vbCrLf
Str1 = Str1 + "Michael" & vbCrLf
Str1 = Str1 + "The MCR Company" & vbCrLf
Close #1
Open File1 For Output Shared As #1
Print #1, Str1
Close #1
strDisplay = strDisplay & Str1 & vbCrLf
strDisplay = strDisplay & "FileScanHeader (sensitivity = False) for 'from : ' is " & vbCrLf
strDisplay = strDisplay & " " & cFileScanHeader(File1, "from: ", "", 0, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FileScanHeader (sensitivity = True) for 'from : ' is " & vbCrLf
strDisplay = strDisplay & " " & cFileScanHeader(File1, "from: ", "", 0, True) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FileScanHeader (sensitivity = False) for 'X-Priority: ' is " & vbCrLf
strDisplay = strDisplay & " " & cFileScanHeader(File1, "X-Priority: ", "", 0, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FileScanHeader (sensitivity = True) for 'X-Priority: ' is " & vbCrLf
strDisplay = strDisplay & " " & cFileScanHeader(File1, "X-Priority: ", "", 0, True) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cFileScanHeader(File1, "from: ", "", 0, False)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestFileScanHeaderForRecipients()
Dim intResult As Integer
Dim strResult As String
Dim strDisplay As String
Dim i As Integer
Dim Str1 As String
Dim Str2 As String
Dim File1 As String
intResult = 0
strResult = ""
strDisplay = ""
File1 = "scanheader.test"
Str1 = Str1 + "From: " + Chr$(34) + "Michael" + Chr$(34) + " <alpouda@kagi.com>" & vbCrLf
Str1 = Str1 + "To: " + Chr$(34) + "Michael" + Chr$(34) + " <alpouda@kagi.com>," & vbCrLf
Str1 = Str1 + " <alpha@pi.edu>," & vbCrLf
Str1 = Str1 + " " + Chr$(34) + "beta" + Chr$(34) + " <beta@pi.edu>," & vbCrLf
Str1 = Str1 + " " + Chr$(34) + "theta" + Chr$(34) & vbCrLf
Str1 = Str1 + "Cc: " + Chr$(34) + "gamma" + Chr$(34) + " <gamma@pi.edu>," & vbCrLf
Str1 = Str1 + " " + Chr$(34) + "rho" + Chr$(34) + " <rho@pi.edu>" & vbCrLf
Str1 = Str1 + "Bcc: " + Chr$(34) + "Michael" + Chr$(34) + " <alpouda@kagi.com>," & vbCrLf
Str1 = Str1 + " " + Chr$(34) + "test" + Chr$(34) + " <test@pi.edu>" & vbCrLf
Str1 = Str1 + "Subject: message Subject" & vbCrLf
Str1 = Str1 + "Date: Sun, 07 Apr 1998 07:07:07 +0200" & vbCrLf
Str1 = Str1 + "MIME-Version: 1.0" & vbCrLf
Str1 = Str1 + "Content-Type: text/plain;" & vbCrLf
Str1 = Str1 + "CharSet = " + Chr$(34) + "iso-8859-1" + Chr$(34) + "" & vbCrLf
Str1 = Str1 + "Content-Transfer-Encoding: 7bit" & vbCrLf
Str1 = Str1 + "X-Priority: 3" & vbCrLf
Str1 = Str1 + "X-MSMail - Priority: Normal" & vbCrLf
Str1 = Str1 + "X-Unsent: 1" & vbCrLf
Str1 = Str1 + "" & vbCrLf
Str1 = Str1 + "This is a test message." & vbCrLf
Str1 = Str1 + "" & vbCrLf
Str1 = Str1 + "Michael" & vbCrLf
Str1 = Str1 + "The MCR Company" & vbCrLf
Close #1
Open File1 For Output Shared As #1
Print #1, Str1
Close #1
strDisplay = strDisplay & Str1 & vbCrLf
strDisplay = strDisplay & "FileScanHeaderForRecipients (sensitivity = False) for 'from : ' is " & vbCrLf
strDisplay = strDisplay & " " & cFileScanHeaderForRecipients(File1, "from: ", ",", False, "", 0, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FileScanHeaderForRecipients (sensitivity = True) for 'from : ' is " & vbCrLf
strDisplay = strDisplay & " " & cFileScanHeaderForRecipients(File1, "from: ", ",", False, "", 0, True) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FileScanHeaderForRecipients (sensitivity = False) for 'To: ' is " & vbCrLf
strDisplay = strDisplay & " " & cFileScanHeaderForRecipients(File1, "To: ", ",", False, "", 0, False) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FileScanHeaderForRecipients (sensitivity = True) for 'To: ' is " & vbCrLf
strDisplay = strDisplay & " " & cFileScanHeaderForRecipients(File1, "To: ", ",", False, "", 0, True) & vbCrLf & vbCrLf
strDisplay = strDisplay & "FileScanHeaderForRecipients (sensitivity = True, extractonlyaddress = True) for 'To: ' is " & vbCrLf
strDisplay = strDisplay & " " & cFileScanHeaderForRecipients(File1, "To: ", ",", True, "", 0, True) & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
strResult = cFileScanHeaderForRecipients(File1, "from: ", ",", False, "", 0, False)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub