HTML Help Keyword Search

It's hard for me to figure out how to get the keyword search ( HH_KEYWORD_LOOKUP ) to work in the HTML help. If I have an index that looks like this:

 Machine Add Edit Selection 

How to specify a keyword search that causes the selection of a machine? "Machine; Selection" calls the keyword Machine; Choice and Machine Choice do not work at all; nor “Machine Choice,” even if that’s what is displayed on the “Index” tab in the HTML help viewer, if the user manually selects a suitable topic.

+1
source share
2 answers

I think I read (in many of my search engines) that HH_KEYWORD_LOOKUP is broken down into HTML help, sigh. So, I came up with this search solution. It will open the chm file and enter the keyword in the search field and press the ENTER key to manually search.

 procedure PostKey(aKey: Word; const aShift: TShiftState; aSpeciaKey: Boolean); type TShiftKeyInfo = record shift: Byte; vkey: Byte; end; byteset = set of 0..7; const shiftkeys: array [1..3] of TShiftKeyInfo = ((shift: Ord(ssCtrl); vkey: VK_CONTROL), (shift: Ord(ssShift); vkey: VK_SHIFT), (shift: Ord(ssAlt); vkey: VK_MENU)); var flag: DWORD; bShift: ByteSet absolute aShift; i: Integer; begin for i := 1 to 3 do begin if shiftkeys[i].shift in bShift then keybd_event(shiftkeys[i].vkey, MapVirtualKey(shiftkeys[i].vkey, 0), 0, 0); end; { For } if aSpeciaKey then flag := KEYEVENTF_EXTENDEDKEY else flag := 0; keybd_event(aKey, MapvirtualKey(aKey, 0), flag, 0); flag := flag or KEYEVENTF_KEYUP; keybd_event(aKey, MapvirtualKey(aKey, 0), flag, 0); for i := 3 downto 1 do begin if shiftkeys[i].shift in bShift then keybd_event(shiftkeys[i].vkey, MapVirtualKey(shiftkeys[i].vkey, 0), KEYEVENTF_KEYUP, 0); end; { For } end; procedure CHMSearch(aCHMFilename, aSearch: string); var cfn: string; qry: THHFtsQuery; hnd: HWND; procedure DoSearch(aMsg: string); var i,n: Integer; c: Char; shift: TShiftState; begin if hnd = 0 then Exit; Windows.SetFocus(hnd); n := Length(aMsg); if n > 0 then begin for i := 1 to n do begin c := aMsg[i]; shift := []; case c of 'a'..'z': shift := []; 'A'..'Z': shift := [ssShift]; '_': // underscore key begin keybd_event(VK_SHIFT, 0, 0, 0); keybd_event(VK_OEM_MINUS, 0, 0, 0); keybd_event(VK_OEM_MINUS, 0, KEYEVENTF_KEYUP, 0); keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0); continue; end; '$': // $ key begin PostKey(Ord('4'), [ssShift], False); continue; end; end; PostKey(Ord(UpCase(c)), shift, False); end; PostKey(VK_RETURN, [], False); PostKey(VK_RETURN, [], False); end; end; begin cfn := ChangeFileExt(aCHMFilename, '.chm'); FillChar(qry, SizeOf(qry), 0); qry.cbStruct := SizeOf(THHFtsQuery); qry.fExecute := TRUE; HH.HtmlHelpA(GetDesktopWindow, PAnsiChar(AnsiString(cfn)), HH_DISPLAY_TOC, 0); hnd := HH.HtmlHelpA(GetDesktopWindow, PAnsiChar(AnsiString(cfn)), HH_DISPLAY_SEARCH, Cardinal(@qry)); DoSearch(aSearch); end; 
+1
source

ahh !!!

After several hours of input and testing, I realized that between the first-level keyword and the second-level keyword, two spaces are required, and finally the “Enter” key is required to show the topic associated with the second keyword !!!

Remember exactly two spaces! one or three do not work. The trick is that by typing the second and second keywords, a certain keyword will be highlighted in the list of keywords, which may make you think that you have already made a mistake and would not continue to type the second keyword! Is this a hoax to a Microsoft engineer?

However, although it works manually, it seems that the software API does not work immediately with two spaces. If I call the following API in C # when I press the F1 key (I have to use a “space” to represent a space here, because this site overlays two spaces on one if I use real space):

System.Windows.Forms.Help.ShowHelp (this, "file: /// C: /apps/MyHelpContentNew/QACT.chm", System.Windows.Forms.HelpNavigator.KeywordIndex, "key2'space''space" x_subkey_of_key2 " );

it does not display the theme associated with x_subkey_of_key2. But he’s almost there, a help window appears with the right two-level keywords placed in the text search text, but there is no “Car-Return”!

Then I tried to add a car return as follows:

System.Windows.Forms.Help.ShowHelp (this, "file: /// C: /apps/MyHelpContentNew/QACT.chm", System.Windows.Forms.HelpNavigator.KeywordIndex, "key2'space''space" x_subkey_of_key2 \ P");

This does not work either. Therefore, I think that I need to send the car return key to the help window. Will be published if I ever implement it.

0
source

All Articles