gpt4 book ai didi

Delphi消息框出现在其他窗体后面

转载 作者:行者123 更新时间:2023-12-03 14:47:40 25 4
gpt4 key购买 nike

我使用下面的代码在 Delphi 7 中创建一个消息框。但是,我在屏幕上还有另一个表单,其 FormStyle 设置为 fsStayOnTop 并且消息框出现在后面这种形式。

有什么办法可以强制messagebox出现在前面吗?

    if Application.MessageBox('Amessage here','Title', +MB_APPLMODAL + MB_ICONQUESTION + MB_YESNO) = IDNO then

最佳答案

调用NormalizeTopMosts在显示消息框之前。

Use NormalizeTopMosts to allow a message box or dialog box that is displayed using the Windows API functions (such as MessageBox and MessageDlg) directly, appear on top of a topmost form. Otherwise the topmost form remains on top, and may obscure the message box.

(希望它在 Delphi 7 中可用。)

编辑:不确定否决票。如果它暗示OP应该使用原生的方向 MessageBox函数并将其父级 HWND 设置为最顶层窗口 - 我同意。但也许由于某种原因这是不可能的。

关于Delphi消息框出现在其他窗体后面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8007449/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com