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;