Solved

How to execute a .cnt (Help file)

Posted on 2000-02-22
10
486 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 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no 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…
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…
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…

832 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