如何更改 Delphi 中帮助弹出窗口的位置?

发布于 2025-01-04 11:50:13 字数 460 浏览 3 评论 0原文

我有下面的代码,现在显示了可用的标准窗口帮助弹出窗口。有谁知道是否有办法定位此窗口出现的位置?例如,让它出现在用户点击的位置?

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;

干杯

保罗

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

罪#恶を代价 2025-01-11 11:50:13

您应该使用 HH_DISPLAY_TEXT_POPUP 显示弹出帮助。这通过 HH_POPUP 结构为您提供了更大的灵活性,你通过了。使用 pt 字段指定位置:

指定(以像素为单位)弹出窗口顶部中心的位置。

Helpware 站点提供了一些示例 Delphi 代码:

{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;

事实上,我认为您已经找到了此页面判断通过您的代码,但只需要进一步阅读页面下方的内容。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文