Dapet ide menarik, ide ini di dapat ketika saya melihat teman saya yang sering membaca artikel/diary orang lain tanpa sepengetahuan yang punya artikel/diary tersebut, kali ini saya ingin menshare aplikasi sejenis notepad tapi lebih sederhana yang di buat dari visual basic 6.0, dan saya beri nama "make a secret file",
"sejenis notepad .. ? berarti sama dong dengan notepad", mungkin beberapa dari agan-agan akan berpikir seperti itu, ya memang sejenis tetapi berbeda, perbedaannya dari hasil output file yang di hasilkannya,, hmmm so langsung aja ke TKP..
jalankan program microsoft visual basic 6.0,
dan sekarang masukan component tambahan yaitu, RichTextBox ..
klik Tab Project > Components .. > centang pada bagian "Microsoft Rich Textbox Control 6.0" > ok
lalu masukan component RichTextBox ke form, sesuaikan dengan keinginan agan,
lalu ke menu editor dan buat menu File yang berisikan Save, Load, Minimize, dan Exit
dan berikut contohnya jika belum jelas
dan hasilnya akan seperti gambar di bawah ini, tampilan menu editor dan RichTextBox
*penjelasan menu editor
untuk codingnya sendiri saya memerlukan bantuan software lain, API-Guide, software tersebut untuk memberikan informasi seputar fungsi-fungsi library dalam windows, dan berikut codingnya
berikut adalah screenshot dari aplikasi yang sudah di buat tadi, dengan contoh "hello wolrd" tanpa tanda kutip, lalu save, dan ketika di buka di notepad, hasilnya akan berbeda ...
password rar: ganyang-angkara.blogspot.com
*..sesama blogger harus saling menghargai, jika agan-agan ingin mengcopas harap cantumkan alamat urlnya, Terimakasih..*
"sejenis notepad .. ? berarti sama dong dengan notepad", mungkin beberapa dari agan-agan akan berpikir seperti itu, ya memang sejenis tetapi berbeda, perbedaannya dari hasil output file yang di hasilkannya,, hmmm so langsung aja ke TKP..
jalankan program microsoft visual basic 6.0,
dan sekarang masukan component tambahan yaitu, RichTextBox ..
klik Tab Project > Components .. > centang pada bagian "Microsoft Rich Textbox Control 6.0" > ok
lalu masukan component RichTextBox ke form, sesuaikan dengan keinginan agan,
lalu ke menu editor dan buat menu File yang berisikan Save, Load, Minimize, dan Exit
dan berikut contohnya jika belum jelas
dan hasilnya akan seperti gambar di bawah ini, tampilan menu editor dan RichTextBox
*penjelasan menu editor
Menu Editor | Name | Caption |
File | xfile | File |
....Save | xsave | Save |
....Load | xload | Load |
....Minimize | xmin | Minimize |
....Exit | xexit | Exit |
untuk codingnya sendiri saya memerlukan bantuan software lain, API-Guide, software tersebut untuk memberikan informasi seputar fungsi-fungsi library dalam windows, dan berikut codingnya
Private Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Private Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOpenfilename As OPENFILENAME) As Long
Dim OFName As OPENFILENAME
Private Function ShowOpen() As String
OFName.lStructSize = Len(OFName)
OFName.hwndOwner = Me.hWnd
OFName.hInstance = App.hInstance
OFName.lpstrFilter = "Secret Files (*.secret)" + Chr$(0) + "*.secret"
OFName.lpstrFile = Space$(254)
OFName.nMaxFile = 255
OFName.lpstrFileTitle = Space$(254)
OFName.nMaxFileTitle = 255
OFName.lpstrInitialDir = "C:\"
OFName.lpstrTitle = "Open File - ganyang-angkara.blogspot.com"
OFName.flags = 0
If GetOpenFileName(OFName) Then
ShowOpen = Trim$(OFName.lpstrFile)
Else
ShowOpen = ""
End If
End Function
Private Function ShowSave() As String
OFName.lStructSize = Len(OFName)
OFName.hwndOwner = Me.hWnd
OFName.hInstance = App.hInstance
OFName.lpstrFilter = "Secret Files (*.secret)" + Chr$(0) + "*.secret"
OFName.lpstrFile = Space$(254)
OFName.nMaxFile = 255
OFName.lpstrFileTitle = Space$(254)
OFName.nMaxFileTitle = 255
OFName.lpstrInitialDir = "C:\"
OFName.lpstrTitle = "Save File - ganyang-angkara.blogspot.com"
OFName.flags = 0
If GetSaveFileName(OFName) Then
ShowSave = Trim$(OFName.lpstrFile)
Else
ShowSave = ""
End If
End Function
Private Function enkrip(fText)
Dim len_chr As Integer
Dim enkrip_chr, out_chr As String
len_chr = Len(fText.Text)
For i = 1 To len_chr
enkrip_chr = Chr(Asc(Mid(fText.Text, i, 1)) + 20)
out_chr = out_chr & enkrip_chr
Next i
enkrip = out_chr
End Function
Public Function dekrip(fText)
Dim len_chr As Integer
Dim dekrip_chr, out_chr, inputan As String
Dim nFileNum As Integer
nFileNum = FreeFile
Open fText For Input As nFileNum
Line Input #nFileNum, inputan
Close nFileNum
len_chr = Len(inputan)
For i = 1 To len_chr
dekrip_chr = Chr(Asc(Mid(inputan, i, 1)) - 20)
out_chr = out_chr & dekrip_chr
Next i
dekrip = out_chr
End Function
Private Sub save_file()
Dim sFile As String
Dim coba As String
sFile = ShowSave
If sFile <> "" Then
Open Left(sFile, Len(sFile) - 1) & ".secret" For Output As #1
Print #1, enkrip(RichTextBox1)
Close #1
End If
End Sub
Private Sub load_file()
Dim sFile As String
Dim tanya As String
If RichTextBox1.Text <> "" Then
tanya = MsgBox("apakah anda yakin ingin membuka file baru", vbOKCancel + vbInformation, "created bya ganang")
If tanya = vbCancel Then
Exit Sub
End If
End If
sFile = ShowOpen
If sFile <> "" Then
RichTextBox1.Text = dekrip(sFile)
End If
End Sub
Private Sub Form_Load()
RichTextBox1.Font.Size = 12
RichTextBox1.Text = ""
End Sub
Private Sub RichTextBox1_KeyUp(KeyCode As Integer, Shift As Integer)
If Shift = 2 Then
If KeyCode = 83 Then save_file
If KeyCode = 79 Then load_file
End If
End Sub
Private Sub xexit_Click()
End
End Sub
Private Sub xload_Click()
load_file
End Sub
Private Sub xmin_Click()
Me.WindowState = 1
End Sub
Private Sub xsave_Click()
save_file
End Sub
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Private Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOpenfilename As OPENFILENAME) As Long
Dim OFName As OPENFILENAME
Private Function ShowOpen() As String
OFName.lStructSize = Len(OFName)
OFName.hwndOwner = Me.hWnd
OFName.hInstance = App.hInstance
OFName.lpstrFilter = "Secret Files (*.secret)" + Chr$(0) + "*.secret"
OFName.lpstrFile = Space$(254)
OFName.nMaxFile = 255
OFName.lpstrFileTitle = Space$(254)
OFName.nMaxFileTitle = 255
OFName.lpstrInitialDir = "C:\"
OFName.lpstrTitle = "Open File - ganyang-angkara.blogspot.com"
OFName.flags = 0
If GetOpenFileName(OFName) Then
ShowOpen = Trim$(OFName.lpstrFile)
Else
ShowOpen = ""
End If
End Function
Private Function ShowSave() As String
OFName.lStructSize = Len(OFName)
OFName.hwndOwner = Me.hWnd
OFName.hInstance = App.hInstance
OFName.lpstrFilter = "Secret Files (*.secret)" + Chr$(0) + "*.secret"
OFName.lpstrFile = Space$(254)
OFName.nMaxFile = 255
OFName.lpstrFileTitle = Space$(254)
OFName.nMaxFileTitle = 255
OFName.lpstrInitialDir = "C:\"
OFName.lpstrTitle = "Save File - ganyang-angkara.blogspot.com"
OFName.flags = 0
If GetSaveFileName(OFName) Then
ShowSave = Trim$(OFName.lpstrFile)
Else
ShowSave = ""
End If
End Function
Private Function enkrip(fText)
Dim len_chr As Integer
Dim enkrip_chr, out_chr As String
len_chr = Len(fText.Text)
For i = 1 To len_chr
enkrip_chr = Chr(Asc(Mid(fText.Text, i, 1)) + 20)
out_chr = out_chr & enkrip_chr
Next i
enkrip = out_chr
End Function
Public Function dekrip(fText)
Dim len_chr As Integer
Dim dekrip_chr, out_chr, inputan As String
Dim nFileNum As Integer
nFileNum = FreeFile
Open fText For Input As nFileNum
Line Input #nFileNum, inputan
Close nFileNum
len_chr = Len(inputan)
For i = 1 To len_chr
dekrip_chr = Chr(Asc(Mid(inputan, i, 1)) - 20)
out_chr = out_chr & dekrip_chr
Next i
dekrip = out_chr
End Function
Private Sub save_file()
Dim sFile As String
Dim coba As String
sFile = ShowSave
If sFile <> "" Then
Open Left(sFile, Len(sFile) - 1) & ".secret" For Output As #1
Print #1, enkrip(RichTextBox1)
Close #1
End If
End Sub
Private Sub load_file()
Dim sFile As String
Dim tanya As String
If RichTextBox1.Text <> "" Then
tanya = MsgBox("apakah anda yakin ingin membuka file baru", vbOKCancel + vbInformation, "created bya ganang")
If tanya = vbCancel Then
Exit Sub
End If
End If
sFile = ShowOpen
If sFile <> "" Then
RichTextBox1.Text = dekrip(sFile)
End If
End Sub
Private Sub Form_Load()
RichTextBox1.Font.Size = 12
RichTextBox1.Text = ""
End Sub
Private Sub RichTextBox1_KeyUp(KeyCode As Integer, Shift As Integer)
If Shift = 2 Then
If KeyCode = 83 Then save_file
If KeyCode = 79 Then load_file
End If
End Sub
Private Sub xexit_Click()
End
End Sub
Private Sub xload_Click()
load_file
End Sub
Private Sub xmin_Click()
Me.WindowState = 1
End Sub
Private Sub xsave_Click()
save_file
End Sub
berikut adalah screenshot dari aplikasi yang sudah di buat tadi, dengan contoh "hello wolrd" tanpa tanda kutip, lalu save, dan ketika di buka di notepad, hasilnya akan berbeda ...
moga bermanfaat bagi agan-agan yang ingin mencobanya,
moga berhasil mencobanya..
Download http://adf.ly/1ZL0PImoga berhasil mencobanya..
password rar: ganyang-angkara.blogspot.com
*..sesama blogger harus saling menghargai, jika agan-agan ingin mengcopas harap cantumkan alamat urlnya, Terimakasih..*