×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

unalbe to close the chm file

unalbe to close the chm file

unalbe to close the chm file

(OP)
Hello all,
I have an application in vb6 and i have created a chm file with html workshop. When i run the program the chm file looks working fine. Although, if i call the chm file and then close the application the vb6 crashes.
I tried:
Call HTMLHelp(Me.hWnd, "", HH_CLOSE_ALL, 0) in the query unload of MDImainForm the vb6 doesn't crashes but the chm file still doesnot close. Any help will be much appreciated.

RE: unalbe to close the chm file

Here is something that you can try.

1. Add a reference to the 'Windows Scrpit Host Object Model'

2. Declare a variable of the correct scope, I used global.

CODE

   '// Object used when viewing the help files.
   Public execObject1 As WshExec

3. Call the help files. 'hh.exe' is for HTML help.

CODE

'// Call the help files.
   On Error GoTo ERR_Handler
   
   With New WshShell
      Set execObject1 = .Exec("hh.exe " & App.Path & "\" & App.HelpFile)
   End With
   Exit Sub
   
ERR_Handler:
   MsgBox "An error has occured. The help files cannot" & vbCrLf & _
      "be displayed at this time.", vbOKOnly + vbDefaultButton1 + _
      vbExclamation + vbApplicationModal, "Cannot Display Help Files"]

4. When you are terminating your app, destroy the object that holds your help files.

CODE

   '// Close the help files if they are still open.
   If Not execObject1 Is Nothing Then execObject1.Terminate

zemp

RE: unalbe to close the chm file

(OP)
Thank you zemp but this doesnot solve my problem.
I declared these in my module .bas and i called the quithelp in the mdiform query unload and now it works fine.

Const HH_CLOSE_ALL = &H12
Public Sub QuitHelp()
    hwndHelp = HTMLHelp(0&, "", HH_CLOSE_ALL, ByVal 0&)
End Sub

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close