Suchwort

Ulrich Kulle ⌂, Mittwoch, 13.08.2008, 19:41 (vor 5959 Tagen) @ Willie1

und etwas Coding zum lesen ;-)

[code]Public Sub SearchIndexKeyword(ByVal intHelpFile As Integer, ByVal sKeyword As String)
' ----------
' from http://msdn.microsoft.com/library/default.asp>url=/library/en-us/htmlhelp/html/vscon...
' new: http://msdn2.microsoft.com/en-us/library/ms524356.aspx
' modified by Ulrich Kulle [MVP]
' ------------
' cbStruct Specifies the size of the structure. This value must always be filled in before passing the structure to the HTML Help API.
' fReserved This parameter must be set to FALSE.
' pszKeywords Specifies one or more ALink names or KLink keywords to look up. Multiple entries are delimited by a semicolon.
' pszUrl Specifies the topic file to navigate to if the lookup fails. pszURL refers to a valid topic within the specified compiled help (.chm) file and does not support Internet protocols that point to an HTML file.
' pszMsgText Specifies the text to display in a message box if the lookup fails and fIndexOnFail is FALSE and pszURL is NULL.
' pszMsgTitle Specifies the caption of the message box in which the pszMsgText parameter appears.
' pszWindow Specifies the name of the window type in which to display one of the following:
' - The selected topic, if the lookup yields one or more matching topics.
' - The topic specified in pszURL, if the lookup fails and a topic is specified in pszURL.
' The Index tab, if the lookup fails and fIndexOnFail is specified as TRUE.

' fIndexOnFail Specifies whether to display the keyword in the Index tab of the HTML Help Viewer if the lookup fails. The value of pszWindow specifies the Help Viewer.

' pszMsgText and pszMsgTitle.
' If fIndexOnFail is FALSE and pszURL is NULL, a message box appears using the text and caption specified in pszMsgText and pszMsgTitle.


' ALink name and KLink keyword lookups are case sensitive, and multiple keywords are delimited by a semicolon.
' If the lookup yields one or more matching topics, the topic titles appear in the Topics Found dialog box.
' ---------------
Dim hwnd As Long

Dim keyData As HH_AKLINK

With keyData
.cbStruct = Len(keyData) ' size of this structure
.fReserved = 0& ' must be FALSE (really!)
.pszKeywords = sKeyword
.pszUrl = vbNullString
' .pszMsgText = "keyword searched for: " + sKeyword ' REM and message dosn't appear - test to jump to another outside topic
' .pszMsgTitle = "Keyword Not Found" ' REM and message dosn't appear - test to jump to another outside topic
.pszWindow = ""
.fIndexOnFail = 0& ' FALSE
End With

'--- use HH_DISPLAY_INDEX to open the help window ---------
' hwnd = HTMLHelpTopic(hwnd, HFile(intHelpFile), HH_DISPLAY_INDEX, sKeyword) ' uncomment for real search feature
'--- use HH_KEYWORD_LOOKUP to open the topic in the rigt pane ---------
hwnd = HtmlHelpIndex(hwnd, HFile(intHelpFile), HH_KEYWORD_LOOKUP, keyData)

If keyData.pszUrl = vbNullString Then ' --- only for test see above
MsgBox "pszURL: is Null"
MsgBox hwnd
With keyData
.cbStruct = Len(keyData) ' size of this structure
.fReserved = 0& ' must be FALSE (really!)
.pszKeywords = sKeyword
.pszUrl = vbNullString
.pszMsgText = "keyword searched for: " + sKeyword ' REM and message dosn't appear
.pszMsgTitle = "Keyword Not Found" ' REM and message dosn't appear
.pszWindow = ""
.fIndexOnFail = 0& ' FALSE
End With
'--- use HH_DISPLAY_INDEX to open the help window ---------
HTMLHelpTopic hwnd, HFile(intHelpFile), HH_DISPLAY_INDEX, sKeyword ' uncomment for real search feature
'--- use HH_KEYWORD_LOOKUP to open the topic in the rigt pane ---------
hwnd = HtmlHelpIndex(hwnd, HFile(intHelpFile), HH_KEYWORD_LOOKUP, keyData)
Else
MsgBox "pszURL: is NOT Null"
MsgBox hwnd
With keyData
.cbStruct = Len(keyData) ' size of this structure
.fReserved = 0& ' must be FALSE (really!)
.pszKeywords = sKeyword
.pszUrl = vbNullString
.pszMsgText = "keyword searched for: " + sKeyword ' REM and message dosn't appear
.pszMsgTitle = "Keyword Not Found" ' REM and message dosn't appear
.pszWindow = ""
.fIndexOnFail = 0& ' FALSE
End With

'--- use HH_DISPLAY_INDEX to open the help window ---------
HTMLHelpTopic hwnd, HFile(intHelpFile), HH_DISPLAY_INDEX, sKeyword ' uncomment for real search feature
'--- use HH_KEYWORD_LOOKUP to open the topic in the rigt pane ---------
HtmlHelpIndex hwnd, HFile(intHelpFile), HH_KEYWORD_LOOKUP, keyData
End If

End Sub[/code]

--
Mit besten Grüßen
Ulrich Kulle
Microsoft Help MVP (2007-2009)
************************
http://www.help-info.de
Unterstützen Sie Help-Info.de durch eine PayPal Spende!
https://www.paypal.com


gesamter Thread:

 

powered by my little forum