-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathModule Buffer Spensav.txt
50 lines (46 loc) · 1.94 KB
/
Module Buffer Spensav.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Private WFD As WIN32_FIND_DATA
Private Declare Function FindFirstFileW Lib "kernel32" (ByVal lpFileName As Long, ByVal lpFindFileData As Long) As Long
Private Declare Function FindNextFileW Lib "kernel32" (ByVal hFindFile As Long, ByVal lpFindFileData As Long) As Long
Private Pindai As Boolean, Pause As Boolean, SmartScan As Boolean
Public jmlFiles As Long, jmlDirs As Long, totalFiles1 As Long
Private VirName As String, TypeVir As String
Private LokasiScan, InfoPath As String, ScanInfo As String
Private Const vbStart = "*"
Private Const vbAllFiles = "*.*"
Public Const vbBackSlash As String = "\"
Private Const vbKeyDot = 46
Private Extension As String
Private Function StripNulls(ByVal OriginalStr As String) As String
If (InStr(OriginalStr, Chr$(0)) > 0) Then
OriginalStr = Left$(OriginalStr, InStr(OriginalStr, Chr$(0)) - 1)
End If
StripNulls = OriginalStr
End Function
Public Function BufferWithSpensav(ByVal path As String) 'Untuk Hitung File Cepat
Dim i As Long, Cari As Long, dirCount As Long
Dim Direktori() As String, NamaFile As String
DoEvents
On Error Resume Next
Cari = FindFirstFileW(StrPtr(path & ChrW$(42)), VarPtr(WFD))
If Not Cari = INVALID_HANDLE_VALUE Then
Do
If Pindai = True Then Exit Do
If (WFD.dwFileAttributes And FILE_ATTRIBUTE_DIRECTORY) Then
If Asc(WFD.cFileName) <> vbKeyDot Then
If (dirCount Mod 10) = 0 Then ReDim Preserve Direktori(dirCount + 10)
dirCount = dirCount + 1
Direktori(dirCount) = StripNulls(WFD.cFileName)
End If
Else
totalFiles1 = totalFiles1 + 1
End If
Loop While FindNextFileW(Cari, VarPtr(WFD))
FindClose (Cari)
For i = 1 To dirCount
BufferWithSpensav path & Direktori(i) & vbBackSlash
Next i
jmlDirs = jmlDirs + 1
frmMain.Text6.Text = "Menghitung " & totalFiles1 & " File Dan " & jmlDirs & " Folder..."
ScanInfo = "Analyzing " & totalFiles1 & " Files and " & jmlDirs & " Directories..."
End If
End Function