Solved

How to execute a .cnt (Help file)

Posted on 2000-02-22
10
475 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 1

Author Comment

by:dosyl
Comment Utility
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
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 1

Author Comment

by:dosyl
Comment Utility
I will accept your comment.
0
 
LVL 3

Expert Comment

by:paulstamp
Comment Utility
Cheers!
0
 
LVL 1

Author Comment

by:dosyl
Comment Utility
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
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now