nmkrishna
asked on
Calling Help file
I need to call an help file (.chm file) from my VB application. I have set the the path of the help file to App.HelpFile. Now, when i call the help file by pressing F1 it works fine. But, i am not able to call the help file from the menu in MDIform. Just i am using Sendkeys to invoke the help file.
Private Sub mnuHelp_Click()
SendKeys "{F1}", True
End Sub
Can any one help me in this regard? Is there anyother way to call the help file?
Private Sub mnuHelp_Click()
SendKeys "{F1}", True
End Sub
Can any one help me in this regard? Is there anyother way to call the help file?
cant you use a commondialog control aswell
Could try:
Shell App.HelpFile
Shell App.HelpFile
See this excellent tutorial:
http://www.ccrowley.f9.co.uk/vbweb/tutorials/html_help.htm
http://www.ccrowley.f9.co.uk/vbweb/tutorials/html_help.htm
Try
Private Sub mnuHelp_Click()
'hh.exe is the view for compiled help (CHM) files
Dim i As Long
i = Shell("hh.exe " & App.HelpFile & "\Yourhelp.chm", vbNormalFocus)End Sub
Private Sub mnuHelp_Click()
'hh.exe is the view for compiled help (CHM) files
Dim i As Long
i = Shell("hh.exe " & App.HelpFile & "\Yourhelp.chm", vbNormalFocus)End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
All of the above calling HTML help(hh.exe) will not open this format of help file. To open the file you could use the shellExecute API as shown below
In a module add the following
Public 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
Public Const SW_SHOWNORMAL = 1
Modify the Click event in your code as shown below...
Private Sub mnuHelp_Click()
Dim lSuccess As Long
'this line will open your helpfile
lSuccess = ShellExecute(Me.hWnd, "open" ,App.Helpfile , vbNullString, vbNullString, SW_SHOWNORMAL)
End Sub
This should do the job...
Cheers...
Ber...
In a module add the following
Public 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
Public Const SW_SHOWNORMAL = 1
Modify the Click event in your code as shown below...
Private Sub mnuHelp_Click()
Dim lSuccess As Long
'this line will open your helpfile
lSuccess = ShellExecute(Me.hWnd, "open" ,App.Helpfile , vbNullString, vbNullString, SW_SHOWNORMAL)
End Sub
This should do the job...
Cheers...
Ber...
ASKER
Hi All,
Thanks a lot for your valuable suggestions. Using Shell command works fine. But, if i click the menu twice two help windows are open.
The solution by ameba works fine.
Thanks
Thanks a lot for your valuable suggestions. Using Shell command works fine. But, if i click the menu twice two help windows are open.
The solution by ameba works fine.
Thanks
Thank you!
Ermm... I know this is not quite right.. but i also have the same problem. But when i use ameba's solution i still have a little problem.
Qn
https://www.experts-exchange.com/questions/20464925/Opening-Help-File-chm-using-VB-NET.html
Thanks
Jimbo
Qn
https://www.experts-exchange.com/questions/20464925/Opening-Help-File-chm-using-VB-NET.html
Thanks
Jimbo