project terdiri dari 1 project dan 1 form dan 1 commandbutton
silahkan anda copas nih kode
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Const SYNCHRONIZE = &H100000
Private Const INFINITE = -1&
Dim FileNama As String
Sub BuatBAT()
Open App.Path + "\Backup.bat" For Output As #1
Print #1, Tab(1); "mysqldump.exe --user=root --password=dikosongi --host=localhost --databases kkpi --opt --quote-names --allow-keywords --complete-insert --add-drop-database --hex-blob> c:\kkpi.sql"
Close #1
End Sub
Private Sub ShellAndWait(ByVal program_name As String)
Dim process_id As Long
Dim process_handle As Long
process_id = Shell(program_name, vbHide)
DoEvents
' Wait for the program to finish.
' Get the process handle.
process_handle = OpenProcess(SYNCHRONIZE, 0, process_id)
If process_handle <> 0 Then
WaitForSingleObject process_handle, INFINITE
CloseHandle process_handle
End If
' Reappear.
End Sub
Private Sub Command1_Click()
BuatBAT
ShellAndWait App.Path + "\Backup.bat"
kill App.Path + "\Backup.bat"
End Sub
sekian dulu semoga aja bermanfaat
chung chin
2 comments
terima kasih sharingya it's work, tapi gimana untuk restorenya brow,
Replykalau mau restore tinggal kodenya diganti aja deh.
ReplyPosting Komentar