Delphi SDI 应用程序 - 不处理级联/平铺水平和平铺垂直平铺?

发布于 2024-08-14 13:51:20 字数 545 浏览 1 评论 0原文

我的应用程序似乎没有接收或处理特定 Windows 版本上级联、水平平铺/垂直平铺的相同 Windows 消息。

Windows XP x32 - 不工作
Windows XP x64 - 未测试
Windows Vista x32 - 不工作
Windows Vista x64 - 工作正常?
Windows 7 x32 - 未测试
Windows 7 x64 - 不工作

任何人都知道为什么会出现这种情况?是否有任何特定于 Vista x64 的东西是其他人所没有的,我自己也不会这么认为!

更新

更具体地说,我指的是当我打开一个或多个应用程序实例时,我按住 Ctrl 键并从任务栏中选择这些实例,然后尝试级联/平铺。

在升级到 Delphi 2009 之前,我们的应用程序的旧版本似乎可以按预期工作。与此不同的是我们现在使用 DevExpress 功能区组件。更令人沮丧的是,我们还有另一个版本的应用程序,它位于 Delphi 2009 中,并且使用功能区并且工作正常!

My application doesn't seem to receive or handle the same windows messages for the Cascade, Tile Horizontal/Tile Vertical on specific windows versions.

Windows XP x32 - Not working
Windows XP x64 - Not tested
Windows Vista x32 - Not working
Windows Vista x64 - Works fine??
Windows 7 x32 - Not tested
Windows 7 x64 - Not working

Anyone any idea's as to why this may be the case? Is there anything specific to Vista x64 that isn't with the others, I wouldn't have thought so myself!

Update

More specifically I am referring to when I have one or more instances of my application open and I hold Ctrl and select these from the task bar and then try to Cascade/Tile.

Older versions of our application prior to upgrading to Delphi 2009 seem to work as expected. Differences from this is we are now using the DevExpress ribbon components. Even more frustratingly is we have another version of the application which is in Delphi 2009 and using the ribbons and that works fine!

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

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

发布评论

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

评论(2

我的痛♀有谁懂 2024-08-21 13:51:20

如果您正在谈论 Delphi 的 TForm.Cascade 和 TForm.Tile 方法,请参阅文档(Delphi 7,因为它很方便):

Use Cascade to arrange MDI child forms so they overlap.

Cascade works only if the form is an MDI parent form (that is, if the form’s 
FormStyle property is fsMDIForm).

如您所见,它们仅针对 MDI 子窗体而设计;它们对非 MDI 子窗体没有影响。这可能可以解释为什么它们不能在您测试过的四个操作系统中的三个上运行。 (我怀疑 Vista x64 的工作是某种侥幸。)

编辑:根据评论,问题与 TForm.Cascade/Tile 无关。

不过,我认为克雷格·杨走在正确的道路上。您是否尝试过添加

Application.ShowMainFormOnTaskbar := True;

到 .DPR 文件?我认为问题可能是,在早期版本的 Delphi 中启动然后更新到较新版本的项目中,未设置该标志,并且应用程序的窗口放在任务栏上。将其更改为主窗体可能会解决问题。

If you're talking about Delphi's TForm.Cascade and TForm.Tile methods, from the documentation (Delphi 7, as it was handy):

Use Cascade to arrange MDI child forms so they overlap.

Cascade works only if the form is an MDI parent form (that is, if the form’s 
FormStyle property is fsMDIForm).

As you can see, they're only designed for MDI child forms; they have no effect on non-MDI child forms. That might explain why they're not working on three of the four OS's you've tested on. (I'd suspect the Vista x64 working is a fluke of some kind.)

EDIT: Based on the comment, the problem isn't related to TForm.Cascade/Tile.

I think Craig Young is on the right track, though. Have you tried adding

Application.ShowMainFormOnTaskbar := True;

to the .DPR file? I think the issue may be that, on projects started in earlier versions of Delphi and then updated to newer versions, the flag isn't set and the Application's window is what's put on the taskbar. Changing it to the main form instead may fix the issue.

做个少女永远怀春 2024-08-21 13:51:20

一个简单的 Delphi 应用程序有两个“主”句柄。一个用于主窗体,另一个用于 TApplication 实例。

就我个人而言,我不使用在桌面上平铺或级联应用程序的功能(我更喜欢最大化运行)。因此,我从来没有费心去研究这种行为。但我可以给出一些指示:

  • 最有可能的是 TApplication.WndProc 方法正在接收消息,但它无助于尝试调整消息大小。
  • 我建议您拦截相关消息并将它们简单地传递到主窗体的句柄。
    • TApplication.OnMessage 事件是最简单的,应该足够了。
    • 如果没有,您可以尝试使用 TApplication.HookMainWindow();

A simple Delphi app has two 'main' handles. One is for the main form, and the other for the TApplication instance.

Personally I don't use the functionality to tile or cascade applications on the desktop (I prefer to run things maximised). Consequently, I've never bothered to dig around with that behaviour. But I can give some pointers:

  • Most likely the TApplication.WndProc method is receiving the message, but it doesn't help trying to resize that.
  • I suggest you intercept the relevant messages and simply pass them on to the main form's handle.
    • The TApplication.OnMessage event is the simplest, and should suffice.
    • If not, you could try using TApplication.HookMainWindow();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文