Solved

How to execute a .cnt (Help file)

Posted on 2000-02-22
10
507 Views
Last Modified: 2010-05-18
If you have something better let me know.
I use this :
Global Const HELP_QUIT = 2
Global Const HELP_INDEX = 3
Global Const HELP_HELPONHELP = 4
Global Const HELP_PARTIALKEY = &H105

Declare Function WinHelp Lib "user32" Alias "WinHelpA" _
      (ByVal hwnd As Long, ByVal lpHelpFile As String, _
      ByVal wCommand As Long, ByVal dwData As Long) As Long

Sub HelpFile(frmForm As Form, nHelpCmd As Integer)
   
   Dim i As Integer
   Dim nFlag As Integer
   Dim aData As Variant
   '
   If Len(LTrim(RTrim(App.HelpFile))) = 0 Then
      MsgBox "No Help File Available"
      GoTo HelpFile_Exit
   End If
   '
   Select Case nHelpCmd
      Case Is = HELP_QUIT
         nFlag = True
      Case Is = HELP_INDEX
         nFlag = True
      Case Is = HELP_HELPONHELP
         nFlag = True
      Case Is = HELP_PARTIALKEY
         nFlag = True
      Case Else
         nFlag = False 'invalid command!
   End Select
   '
   If nFlag = True Then
      If nHelpCmd = HELP_PARTIALKEY Then
         i = WinHelp(frmForm.hwnd, App.HelpFile, nHelpCmd, "")
      Else
         i = WinHelp(frmForm.hwnd, App.HelpFile, nHelpCmd, 0&)
      End If
   Else
      MsgBox "Invalid Help Command Value"
   End If
   '
HelpFile_Exit:

End Sub

0
Comment
Question by:dosyl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 3

Expert Comment

by:paulstamp
ID: 2550423
No need to use APIs.. the common dialog control allows access to the App's help file. Set the HelpFile property and the HelpCommand to one of the cdlHelp constants (see object browser for full list - includes all the commands in your example)

An example is below :

CommonDialog1.HelpFile = app.path & "\myhelp.hlp"
CommonDialog1.HelpCommand = cdlHelpContents
      CommonDialog1.ShowHelp  
0
 
LVL 1

Author Comment

by:dosyl
ID: 2550712
paulstamp
I have the same problem with your code. It is always the first topic is displayed not the .cnt why?

Another thing, i don't understand why the value of cdlHelpContents=3 and cdlHelpIndex=3, if i take this constants i'll display always the same thing(I believe).
0
 
LVL 3

Accepted Solution

by:
paulstamp earned 100 total points
ID: 2550784
Sorry - you're right... that code works with the old style help files. This works though :


Const HelpCNT = &HB

With CommonDialog1
      .HelpFile = "tdbg6.hlp"
      .HelpCommand = HelpCNT Or cdlSetHelpntents
      .ShowHelp
End With

Note HelpCNT is not an intrinsic constant so you do need to set it in your declarations
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:dosyl
ID: 2550881
paulstamp
This time, it'working, but i don't understand what cdlSetHelpntents(cdlSetHelpContents) does?

And i would like you tell me :
I don't understand why the value of cdlHelpContents=3 and cdlHelpIndex=3, if i take this constants i'll display always the same thing(I believe).

 
     
0
 
LVL 3

Expert Comment

by:paulstamp
ID: 2550910
The new example adds a new constant - cdlHelpContents and cdlHelpIndex both equal 3 because in old (Win 3.1) help files the index and contents were both the same thing. HelpCNT is a new constant which differentiates between the two - if you dont add this then you will get the index all the time.
0
 
LVL 1

Author Comment

by:dosyl
ID: 2551033
I will accept your comment.
0
 
LVL 3

Expert Comment

by:paulstamp
ID: 2551063
Cheers!
0
 
LVL 1

Author Comment

by:dosyl
ID: 2551147
paulstamp
    I want your idea. Because i have 15 forms, must i use commondialog on each form or use my APIs with the constant HelpCnt or another idea.
Thank's.
0
 
LVL 1

Author Comment

by:dosyl
ID: 2551363
paulstamp
Another thing, if i want to open the helpfile on the Index tab or the Find tab, how do you do?
Please answer to my previous comment too.
0
 
LVL 3

Expert Comment

by:paulstamp
ID: 2577419
You should be able to use a single common dialog control and reference it from other places... ie frmMain.CommonDialog1.ShowHelp.

I'm not aware of any way of selecting different tabs on the contents dialog - sorry.
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month7 days, 15 hours left to enroll

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question