Hi,
I have a working database with a custom help file, both working as planned. I use the code from the microsoft developer site see below:
Option Compare Database
Option Explicit
Public Const HELP_CONTEXT = &H1 'Display topic for Help context ID.
Public Const HELP_QUIT = &H2 'Terminate Help.
Public Const HELP_INDEX = &H3 'Display Help index.
Public Const HELP_CONTEXTPOPUP = &H8& 'Display Help context as a pop-up
'window.
Public Const HELP_FINDER = &HB& 'If found, Display container file.
Public Const HELP_KEY = &H101 'Display topic for keyword.
'Declare the WinHelp function.
Declare Sub WinHelp Lib "user32" Alias "WinHelpA" (ByVal Hwnd As Long, _
ByVal lpHelpFile As String, ByVal wCommand As Long, _
ByVal dwData As Any)
Function OpenHelpContainer(ByVal strHelpFileName As String)
'Opens the Help container.
WinHelp Application.hWndAccessApp, ByVal strHelpFileName, _
HELP_FINDER, ByVal vbNullString
End Function
Function OpenHelpIndex(ByVal strHelpFileName As String)
'Opens the Help index.
WinHelp Application.hWndAccessApp, ByVal strHelpFileName, HELP_KEY, _
ByVal ""
End Function
Function OpenHelpIndexWithSearchKey(ByVal strHelpFileName As String, _
ByVal strSearchKey As String)
'Opens the Help index and searches for keyword SKey.
WinHelp Application.hWndAccessApp, ByVal strHelpFileName, HELP_KEY, _
ByVal strSearchKey
End Function
Function OpenHelpWithContextID(ByVal strHelpFileName As String, _
lngContextID As Long)
'Opens the Help file to ContextID.
WinHelp Application.hWndAccessApp, ByVal strHelpFileName, _
HELP_CONTEXT, ByVal lngContextID
End Function
Function OpenHelpWithContextIDPopup(ByVal strHelpFileName As String, _
lngContextID As Long)
'Opens the Help file to ContextID as a pop-up window.
WinHelp Application.hWndAccessApp, ByVal strHelpFileName, _
HELP_CONTEXTPOPUP, ByVal lngContextID
End Function
Function CloseHelpContainer(ByVal strHelpFileName As String)
'Closes the specified Help file.
WinHelp Application.hWndAccessApp, ByVal strHelpFileName, HELP_QUIT, _
ByVal vbNullString
End Function
I then called the function =OpenHelpContainer("wrsu.hlp"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
from my Menu bar.
How do I Programmatically code for a relative path? in case I change installed directory say from C to D drives.
So that where ever I move my application to, I dont have to worry about relinking the help file with the database as far as both are in the same folder.
Step by step please.
Thank you for your help.
eddie
I have a working database with a custom help file, both working as planned. I use the code from the microsoft developer site see below:
Option Compare Database
Option Explicit
Public Const HELP_CONTEXT = &H1 'Display topic for Help context ID.
Public Const HELP_QUIT = &H2 'Terminate Help.
Public Const HELP_INDEX = &H3 'Display Help index.
Public Const HELP_CONTEXTPOPUP = &H8& 'Display Help context as a pop-up
'window.
Public Const HELP_FINDER = &HB& 'If found, Display container file.
Public Const HELP_KEY = &H101 'Display topic for keyword.
'Declare the WinHelp function.
Declare Sub WinHelp Lib "user32" Alias "WinHelpA" (ByVal Hwnd As Long, _
ByVal lpHelpFile As String, ByVal wCommand As Long, _
ByVal dwData As Any)
Function OpenHelpContainer(ByVal strHelpFileName As String)
'Opens the Help container.
WinHelp Application.hWndAccessApp, ByVal strHelpFileName, _
HELP_FINDER, ByVal vbNullString
End Function
Function OpenHelpIndex(ByVal strHelpFileName As String)
'Opens the Help index.
WinHelp Application.hWndAccessApp, ByVal strHelpFileName, HELP_KEY, _
ByVal ""
End Function
Function OpenHelpIndexWithSearchKey(ByVal strHelpFileName As String, _
ByVal strSearchKey As String)
'Opens the Help index and searches for keyword SKey.
WinHelp Application.hWndAccessApp, ByVal strHelpFileName, HELP_KEY, _
ByVal strSearchKey
End Function
Function OpenHelpWithContextID(ByVal strHelpFileName As String, _
lngContextID As Long)
'Opens the Help file to ContextID.
WinHelp Application.hWndAccessApp, ByVal strHelpFileName, _
HELP_CONTEXT, ByVal lngContextID
End Function
Function OpenHelpWithContextIDPopup(ByVal strHelpFileName As String, _
lngContextID As Long)
'Opens the Help file to ContextID as a pop-up window.
WinHelp Application.hWndAccessApp, ByVal strHelpFileName, _
HELP_CONTEXTPOPUP, ByVal lngContextID
End Function
Function CloseHelpContainer(ByVal strHelpFileName As String)
'Closes the specified Help file.
WinHelp Application.hWndAccessApp, ByVal strHelpFileName, HELP_QUIT, _
ByVal vbNullString
End Function
I then called the function =OpenHelpContainer("wrsu.hlp"
from my Menu bar.
How do I Programmatically code for a relative path? in case I change installed directory say from C to D drives.
So that where ever I move my application to, I dont have to worry about relinking the help file with the database as far as both are in the same folder.
Step by step please.
Thank you for your help.
eddie