Link to home
Start Free TrialLog in
Avatar of nmkrishna
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?
Avatar of skhorshid
skhorshid

cant you use a commondialog control aswell
Could try:

Shell App.HelpFile
Avatar of Richie_Simonetti
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

ASKER CERTIFIED SOLUTION
Avatar of ameba
ameba
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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...
Avatar of nmkrishna

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
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