Waktu kemarin-kemarin banyak yang menanyakan bagaimana caranya aplikasi yang dibuat dalam Visual Basic dapat mengakses file *.chm, sebenarnya sih tidak terlalu ribet, namun ada beberapa fungsi Api yang digunakan untuk sourcecode lengkapnya silahkan lihat dibawah…
Const AppFile As String = “dodol.chm” ‘Nama File *.chm Anda!
Dim ExecPath As String ‘Path untuk *.chm Anda!
Private Declare Function ShellExecute Lib “shell32.dll” Alias “ShellExecuteA” _
(ByVal hwnd As Long, ByVal lpszOp As String, _
ByVal lpszFile As String, ByVal lpszParams As String, _
ByVal LpszDir As String, ByVal FsShowCmd As Long) _
As Long
Public Function LaunchApp(ByVal URL As String) As Long
Dim strFile As String
‘Fungsi API untuk mengakses file *.chm
‘Fungsi API untuk membuka file *.chm
On Error Resume Next
strFile = ShellExecute(0&, vbNullString, URL, vbNullString, _
vbNullString, vbNormalFocus)
End Function
Private Sub Command1_Click()
ExecPath = IIf(“/” = Mid(App.Path, Len(App.Path)), App.Path, App.Path) & AppFile
LaunchApp (App.Path & AppFile)
End Sub
‘————–End Of Code—————–





Komentar