|
-
Nov 6th, 2001, 03:07 PM
#1
Thread Starter
Hyperactive Member
Opening a help file.
How do I open a help file at a certain topic or content section of it with a command button? Here's my code thus far. It opens the help file, but I want to jump to a certain spot. I'm doing this in Access too, if that makes a difference. (Likely not)
Code:
Private 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
Private Const HELP_CONTENTS = &H3&
Private Const HELP_QUIT = &H2
Option Compare Database
Option Explicit
Private Function DBPath() As String
Dim strDBPath As String
Dim strDBFile As String
strDBPath = CurrentDb.Name
strDBFile = Dir(strDBPath)
DBPath = Left(strDBPath, Len(strDBPath) - Len(strDBFile))
End Function
Private Function FileExists(ByVal FileName As String) As Boolean
If Dir(FileName) = "" Then
FileExists = False
Else
FileExists = True
End If
End Function
Private Sub Command0_Click()
Dim strHelpFile As String
strHelpFile = DBPath & "LegalTracking.hlp"
If FileExists(strHelpFile) Then
WinHelp Me.hwnd, strHelpFile, HELP_CONTENTS, 0
Else
MsgBox "Could not locate help file. Try contacting your database administrator.", vbOKOnly, "Unable to locate help file."
End If
End Sub
-
Nov 6th, 2001, 03:39 PM
#2
Here is some MSDN sample code with a lot of comments:
http://support.microsoft.com/support.../Q121/1/15.ASP
Here is what www.allapi.net has:
Code:
Const HELP_COMMAND = &H102&
Const HELP_CONTENTS = &H3&
Const HELP_CONTEXT = &H1
Const HELP_CONTEXTPOPUP = &H8&
Const HELP_FORCEFILE = &H9&
Const HELP_HELPONHELP = &H4
Const HELP_INDEX = &H3
Const HELP_KEY = &H101
Const HELP_MULTIKEY = &H201&
Const HELP_PARTIALKEY = &H105&
Const HELP_QUIT = &H2
Const HELP_SETCONTENTS = &H5&
Const HELP_SETINDEX = &H5
Const HELP_SETWINPOS = &H203&
Private Declare Function WinHelp Lib "user32.dll" Alias "WinHelpA" (ByVal hWndMain As Long, ByVal lpHelpFile As String, ByVal uCommand As Long, dwData As Any) As Long
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: [email protected]
WinHelp Me.hwnd, "C:\Windows\help\common.hlp", HELP_CONTENTS, ByVal 0
End Sub
-
Nov 6th, 2001, 04:54 PM
#3
Thread Starter
Hyperactive Member
Thanks a lot there buddy. I needed to use the
HELP_CONTEXT constant
and it's the topic ID. Works great now.
-
Nov 6th, 2001, 05:28 PM
#4
If you don't need to show a specific context ID, you could just shell WinHelp like:
Code:
Shell "WinHelp MyHelpFile.hlp", 1
-
Nov 6th, 2001, 08:56 PM
#5
Thread Starter
Hyperactive Member
I think you missed the point, but thanks for contributing though.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|