• Buat Project Baru, Lalu Add Components
(CommonDialog "Microsoft CommonDialog Control 6.0" Atau ClassModules Commond Dialog)
Lalu Tambahkan Ke Form..
• Tambah TextBox (Textbox1 Dan Textbox2 )
Lengkap Dengan Label Lokasi Dan Checksum..
• Tambah 3 CommandButton (Command1, Command2, Command3)
Lalu Coding Pada Form :
'######Start Here######
Private Sub Command1_Click()
CommonDialog.ShowOpen
Text1.Text = CommonDialog.FileName
End Sub
Private Sub Command2_Click()
Clipboard.Clear
Clipboard.SetText Text2.Text
End Sub
Private Sub Command3_Click()
Text2.Text = GetChecksum(Text1.Text)
End Sub
'######End Here######
•Yg Terakhir Tambah Satu Modules Untuk Membuat Perintah (Name : ModChecksum)
Coding Modules : '######Start Here######
' =================================
' Crc By Wheldt
' improved from Wheldt Protection
' =================================
Option Explicit
Public Function GetChecksum(FilePath As String) As String
Dim Data As String * 850
Dim Checksum() As Double
Dim i As Integer
ReDim Checksum(1): ReDim Checksum(2): ReDim Checksum(3)
Select Case FileLen(FilePath)
Case Is = 0 ' Bila ukuran file 0 byte
GetChecksum = "NULL"
If GetChecksum = "NULL" Then Debug.Print "Checksum NULL : File " & FileLen(FilePath) & " byte"
Exit Function
Case Else
Data = ICSC(FilePath)
End Select
For i = 1 To (Len(Data) / 3) Step 1
Checksum(1) = Checksum(1) + Asc(Mid(Data, i, 1)) ^ 2
Next
For i = ((Len(Data) / 3) + 1) To (Len(Data) - (Len(Data) / 3)) Step 3
Checksum(2) = Checksum(2) + Asc(Mid(Data, i, 1)) ^ 3
Next
For i = ((Len(Data) - (Len(Data) / 3)) + 1) To (Len(Data)) Step 2
Checksum(3) = Checksum(3) + Asc(Mid(Data, i, 1)) ^ 2
Next
GetChecksum = Hex$(Checksum(1)) & Hex$(Checksum(2)) & Hex$(Checksum(3))
If GetChecksum = "000" Then Debug.Print "Checksum 000 : Gagal"
End Function
Private Function ICSC(FilePath As String) As String
Dim String1 As String * 50 ' Variabel2 string dibatasi ruangnya supaya scanning dapat berjalan dengan cepat
Dim String2 As String * 250
Dim String3 As String * 250
Dim String4 As String * 250
Dim String5 As String * 50
Dim FileString As String * 850
Select Case FileLen(FilePath)
Case Is >= 1000 ' bila file lebih besar sama dengan dari 1000byte
Open FilePath For Binary Access Read As #1
Get #1, 25, String1
Get #1, 250, String2
Get #1, (FileLen(FilePath) / 2) - 125, String3
Get #1, FileLen(FilePath) - 500, String4
Get #1, FileLen(FilePath) - 75, String5
Close #1
FileString = String1 & String2 & String3 & String4 & String5
ICSC = FileString
Case Else ' selainnya
Open FilePath For Binary Access Read As #1
Get #1, , String1
Get #1, (FileLen(FilePath) / 2) / 2, String2
Get #1, FileLen(FilePath) - (FileLen(FilePath) / 2), String3
Close #1
FileString = String1 & String2 & String3
ICSC = FileString
End Select
End Function
'######End Here######
Tinggal COmpile Ke Exe
(CommonDialog "Microsoft CommonDialog Control 6.0" Atau ClassModules Commond Dialog)
Lalu Tambahkan Ke Form..
• Tambah TextBox (Textbox1 Dan Textbox2 )
Lengkap Dengan Label Lokasi Dan Checksum..
• Tambah 3 CommandButton (Command1, Command2, Command3)
Lalu Coding Pada Form :
'######Start Here######
Private Sub Command1_Click()
CommonDialog.ShowOpen
Text1.Text = CommonDialog.FileName
End Sub
Private Sub Command2_Click()
Clipboard.Clear
Clipboard.SetText Text2.Text
End Sub
Private Sub Command3_Click()
Text2.Text = GetChecksum(Text1.Text)
End Sub
'######End Here######
•Yg Terakhir Tambah Satu Modules Untuk Membuat Perintah (Name : ModChecksum)
Coding Modules : '######Start Here######
' =================================
' Crc By Wheldt
' improved from Wheldt Protection
' =================================
Option Explicit
Public Function GetChecksum(FilePath As String) As String
Dim Data As String * 850
Dim Checksum() As Double
Dim i As Integer
ReDim Checksum(1): ReDim Checksum(2): ReDim Checksum(3)
Select Case FileLen(FilePath)
Case Is = 0 ' Bila ukuran file 0 byte
GetChecksum = "NULL"
If GetChecksum = "NULL" Then Debug.Print "Checksum NULL : File " & FileLen(FilePath) & " byte"
Exit Function
Case Else
Data = ICSC(FilePath)
End Select
For i = 1 To (Len(Data) / 3) Step 1
Checksum(1) = Checksum(1) + Asc(Mid(Data, i, 1)) ^ 2
Next
For i = ((Len(Data) / 3) + 1) To (Len(Data) - (Len(Data) / 3)) Step 3
Checksum(2) = Checksum(2) + Asc(Mid(Data, i, 1)) ^ 3
Next
For i = ((Len(Data) - (Len(Data) / 3)) + 1) To (Len(Data)) Step 2
Checksum(3) = Checksum(3) + Asc(Mid(Data, i, 1)) ^ 2
Next
GetChecksum = Hex$(Checksum(1)) & Hex$(Checksum(2)) & Hex$(Checksum(3))
If GetChecksum = "000" Then Debug.Print "Checksum 000 : Gagal"
End Function
Private Function ICSC(FilePath As String) As String
Dim String1 As String * 50 ' Variabel2 string dibatasi ruangnya supaya scanning dapat berjalan dengan cepat
Dim String2 As String * 250
Dim String3 As String * 250
Dim String4 As String * 250
Dim String5 As String * 50
Dim FileString As String * 850
Select Case FileLen(FilePath)
Case Is >= 1000 ' bila file lebih besar sama dengan dari 1000byte
Open FilePath For Binary Access Read As #1
Get #1, 25, String1
Get #1, 250, String2
Get #1, (FileLen(FilePath) / 2) - 125, String3
Get #1, FileLen(FilePath) - 500, String4
Get #1, FileLen(FilePath) - 75, String5
Close #1
FileString = String1 & String2 & String3 & String4 & String5
ICSC = FileString
Case Else ' selainnya
Open FilePath For Binary Access Read As #1
Get #1, , String1
Get #1, (FileLen(FilePath) / 2) / 2, String2
Get #1, FileLen(FilePath) - (FileLen(FilePath) / 2), String3
Close #1
FileString = String1 & String2 & String3
ICSC = FileString
End Select
End Function
'######End Here######
Tinggal COmpile Ke Exe
0 komentar:
Posting Komentar