I have the code below which now shows a standard windows help popup where available. Does anyone know if there is a way of positioning where this window appears? For example, to make it appear where the user has clicked?
function HelpPopupWindow(Command: Word; Data: Integer; var CallHelp: Boolean): Boolean;
var
dwIDs: array[0..3] of DWord;
begin
dwIDs[0] := Handle;
dwIDs[1] := Data;
dwIDs[2] := 0;
dwIDs[3] := 0;
HtmlHelp(Handle, PChar('HELP FILE LOCATION HERE::/cshelp.txt'), HH_TP_HELP_CONTEXTMENU, DWORD(@dwIDs[0]));
CallHelp := False;
end;
Cheers
Paul
You should use HH_DISPLAY_TEXT_POPUP
to display the popup help. This gives you more flexibility through the HH_POPUP
structure that you pass. Use the pt
field to specify the position:
Specifies (in pixels) where the top center of the pop-up window should be located.
The Helpware site gives some sample Delphi code:
{Show HH Popup using a string (StringID) from text file in a CHM
StringID: eg. 99; CHMTextFile: eg. _runDir + 'help.chm::/cshelp.txt'}
function HH_ShowPopupHelp3(aParent: TForm; StringID: Integer;
CHMTextFile: String; XYPos: TPoint): HWND;
var hhpopup: HH.THHPopup;
begin
with hhpopup do
begin
cbStruct := sizeof(hhpopup); //sizeof this structure
hinst := 0; //no used
idString := StringID; //topic number in a text file.
pszText := nil; //no used
pt := XYPos; //top center of popup
clrForeground := COLORREF(-1); //use -1 for default - RGB value
clrBackground := COLORREF(-1); //use -1 for default - RGB value
rcMargins := Rect(-1,-1,-1,-1);//amount of space between edges
pszFont := '';
end;
Result := HtmlHelp(aParent.Handle, PChar(CHMTextFile),
HH_DISPLAY_TEXT_POPUP, DWORD(@hhpopup));
end;
In fact I think you already found this page judging by your code, but just needed to read a bit further down the page.