使用实时弹出菜单最小化 Delphi 应用程序

发布于 2024-08-14 10:11:55 字数 379 浏览 3 评论 0原文

我正在尝试在计时器中运行它:

Application.Minimize;
ShowWindow( Application.handle, SW_HIDE );

它一直在代码中,我们刚刚发现当您有一个弹出菜单处于活动状态时它不起作用,它不会最小化 MDI 父窗口。

我想如果我可以在运行此代码之前关闭弹出菜单,那么我就可以了。问题是,这段代码位于 MDI 父级中,我不知道当前弹出菜单在哪里。无论它是另一个表单工具栏的一部分、这个表单工具栏、右键单击的结果还是空格键旁边看似毫无意义的键的一部分,都没关系。

那么,有没有办法隐藏整个程序中的活动弹出菜单?

另外,如果有比我用来最小化的更好的代码块来规避这个问题,那也是很棒的信息。

I'm attempting to run this in a timer:

Application.Minimize;
ShowWindow( Application.handle, SW_HIDE );

It's been in the code forever and we just discovered that it doesn't work when you have a popupmenu active, it doesn't minimize the MDI parent window.

I figure if I can close the popup menu before running this code, then I'll be ok. Problem is, this code is in an MDI Parent and I have no idea where the current popup menu is. It doesn't matter if it's part of another form's tool bar, this forms tool bar, the product of a right click or that seemingly pointless key next to the space bar.

So, is there a way to hide the active popup menu in my entire program?

Also, if there's a better hunk of code than what I'm using to minimize that'll circumvent this issue, that'd be awesome info too.

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

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

发布评论

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

评论(1

假装爱人 2024-08-21 10:11:55

要关闭弹出菜单,您可以

  if GetCapture <> 0 then
    SendMessage(GetCapture, WM_CANCELMODE, 0, 0);

在尝试最小化表单之前在代码中使用。

To close a popup menu you can use

  if GetCapture <> 0 then
    SendMessage(GetCapture, WM_CANCELMODE, 0, 0);

in your code before you try to minimize the form.

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