0% found this document useful (0 votes)
10 views3 pages

Membuat Program Backup Database

Berbentuk

Uploaded by

Budi Mulyono
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

Membuat Program Backup Database

Berbentuk

Uploaded by

Budi Mulyono
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

www.konsultasivb.com, www.belajarvb.

com,
www.pemrogramanvb.com, www.tugasakhirvb.com

Oleh : Uus Rusmawan


Hal - 1 -

Membuat Program Backup Database


Program ini cukup penting sebagai sarana Backup Data, walaupun Windows Explorer
mampu melakukannya, tidak ada salahnya jika kita coba membuat programnya dalam
Visual Basic.

Listing Program

Private Declare Function SHFileOperation Lib "Shell32.dll"


Alias "SHFileOperationA" (lpFileOP As shfileopstruct) As
Long
Private Const FO_copy = &H2
Private Const fof_allowundo = &H40

Private Type shfileopstruct


hwnd As Long
wfunc As Long
pfrom As String
pto As String
Fflags As Integer
Faborted As Boolean
hnamemaps As Long
sprogress As String
End Type

Public Sub copy(ByVal asal As String, ByVal tujuan As


String)
www.konsultasivb.com, www.belajarvb.com,
www.pemrogramanvb.com, www.tugasakhirvb.com

Oleh : Uus Rusmawan


Hal - 2 -

Dim x As shfileopstruct
With x
.hwnd = 0
.wfunc = FO_copy
.pfrom = asal & vbNullChar & vbNullChar
.pto = tujuan & vbNullChar & vbNullChar
.Fflags = fof_allowundo
End With
SHFileOperation x
End Sub

Private Sub Form_Load()


Dir1.Path = "C:\Program Pelengkap"
Dir2.Path = "C:\"
End Sub

Private Sub Command1_Click()


On Error Resume Next
If Text1 = "" Then
MsgBox "Anda belum memilih file yang akan dicopy"
Exit Sub
ElseIf Text2 = "" Then
MsgBox "Anda tidak memilih direktori tujuan peng-Copy-
an"
Exit Sub
End If
copy Text1.Text, Text2.Text
MsgBox "File sudah di copy"
End Sub

Private Sub Command1_KeyPress(Keyascii As Integer)


If Keyascii = 27 Then Unload Me
End Sub

Private Sub Drive1_Change()


Dir1.Path = Drive1.Drive
End Sub

Private Sub Drive2_Change()


Dir2.Path = Drive2.Drive
End Sub

Private Sub Dir1_Change()


File1.Path = Dir1.Path
www.konsultasivb.com, www.belajarvb.com,
www.pemrogramanvb.com, www.tugasakhirvb.com

Oleh : Uus Rusmawan


Hal - 3 -

End Sub

Private Sub Dir2_Change()


Text2.Text = Dir2.Path
End Sub

Private Sub File1_Click()


Text1.Text = File1.Path & "\" & File1.FileName
End Sub

You might also like