Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to execute a .cnt (Help file)

Posted on 2000-02-22
10
Medium Priority
?
516 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
  • 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 400 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

782 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