Mhc_Shadow Neophyte
Jumlah posting : 156 Join date : 10.04.11
| Subyek: Memanggil File Executeable menggunakan Common Dialog Thu 13 Oct 2011 - 0:42 | |
| Tambahkan icon Common Dialog dan Command Button pada Form yang sudah tersedia. Jika icon Common Dialog tersebut belum ada di toolbox, maka kita harus menambahkan / mengaktifkan komponen Microsoft Common Dialog 6.0 (SP3) yang ada pada sub menu Components Tambahkan kode fungsi API ke jendela kode : - Code:
-
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const SW_HIDE = 0 masukan kode di bawah ke dalam sub command1_click() : - Code:
-
Dim result As Long CommonDialog1.Filter = "File Executable|*.exe" CommonDialog1.ShowOpen If CommonDialog1.FileName = "" Then Exit Sub Else result = ShellExecute(Me.hwnd, "open", (CommonDialog1.FileName), "", "", SW_HIDE) End If | |
|