LogicSmith
Home - Contact Info - Articles - Files - Links - Adventures - Other Stuff - Dual Monitor Wallpaper
Starting Up
Most of your interaction with WinHelp from Visual Basic is through the WinHelp API call, a part of the Windows operating system. To use this call, it must be declared in a BAS module in your project. I use the following declaration:
Declare Function WinHelpStr Lib "user32" Alias "WinHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData As String) As Long Declare Function WinHelpNum Lib "user32" Alias "WinHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData As Long) As Long
As you will note, I declared the function twice. The last parameter of the function is the reason for this. Depending on the wCommand parameter, the dwData parameter can either be an integer (32-bit long), or it can be a string or structure (32-bit pointer). While you can use the same call for both, you'd need to remember to cast your data to the appropriate form. I find it easier to have one call for numeric commands (such as jumping to a specific topic) and another call for all string or structure commands.
You'd probably also want to declare the commands used by the API in this module:
Public Const HELP_CONTEXT = &H1 Public Const HELP_QUIT = &H2 Public Const HELP_INDEX = &H3 Public Const HELP_CONTENTS = &H3& Public Const HELP_HELPONHELP = &H4 Public Const HELP_SETINDEX = &H5 Public Const HELP_SETCONTENTS = &H5& Public Const HELP_CONTEXTPOPUP = &H8& Public Const HELP_FORCEFILE = &H9& Public Const HELP_TAB = &HF& Public Const HELP_KEY = &H101C& Public Const HELP_COMMAND = &H102& Public Const HELP_PARTIALKEY = &H105& Public Const HELP_MULTIKEY = &H201& Public Const HELP_SETWINPOS = &H203& Public Const HELP_FINDER = &HB
Note: If you're using Visual Basic 4, remove the keyword Public from the constant declarations.
Copyright © 2009 by Dana Cline Last Updated Monday, April 06, 2009 Website hosted by 1and1