告诉 Windows 在哪个监视器上显示对话框

发布于 2024-11-16 16:17:26 字数 271 浏览 3 评论 0原文

我有一个使用多个显示器的程序。该程序正在第二台显示器上显示特殊的可视化效果。在某一时刻,程序使用 Windows shell 函数将文件发送到回收站。但是,当执行此操作时,删除确认对话框会出现在我的可视化效果之上。这是特别有问题的,因为当鼠标位于第二个显示器上时,我的程序使用鼠标挂钩来捕获所有鼠标输入,因此用户甚至无法单击确认对话框。

是否有可能以某种方式告诉 Windows 仅将对话框放置在特定的显示器上?

我正在使用 python,但如果我必须调用 C WinAPI 函数,那应该不是问题

I've got a program which is using multiple monitors. The program is showing special visualizations on the second monitor. At one point, the program uses windows shell functions to send files to the recycle bin. However, when it does this, the delete confirmation dialog comes on top of my visualization. This is particularly problematic, as when the mouse is on the second monitor, my program uses mouse hooks to capture all mouse input, so the user cannot even click the confirmation dialog.

Is it possible to somehow tell Windows to only place dialog boxes on a particular display?

I'm using python, though if I have to call C WinAPI functions that shouldn't be a problem

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

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

发布评论

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

评论(1

你的笑 2024-11-23 16:17:26

您使用哪个函数将文件发送到回收站?如果您使用 SHFileOperation 您可以通过父 HWND。也许将其设置为另一个监视器上不可见的 WS_EX_TOOLWINDOW 窗口。

我希望API将该窗口视为父窗口,并相对于该窗口居中,但我还没有尝试过。

根据您所针对的 Windows 版本,曾经有一种功能可以创建“停靠”到屏幕两侧的桌面带。这会自动计入 作为 rcWork 返回的区域GetMonitorInfo 并应防止对话框与此空间重叠。 可能有另一种方式来声明一个区域“正在使用”,以声明空间禁止的方式,但我不知道它,所以它可能不存在......

您可以做的丑陋而粗暴的事情是自己轮询并移动对话框,但如果这是任何类型的广泛部署或商业应用程序,则可能会弊大于利。

which function are you using to send the files to the recycle bin? if you use SHFileOperation you can pass a parent HWND. perhaps make that an invisible WS_EX_TOOLWINDOW window on the other monitor.

i would expect the API, treating that window as a parent, would center relative to that window, but i haven't tried it.

depending on which version of Windows you are targeting, there used to be a capability to create desk bands that 'dock' to the sides of the screen. this automatically gets factored into the area returned as rcWork by GetMonitorInfo and should prevent dialogs from overlapping this space. There might be another way to declare that a region is "in use" in a way that declares space off-limits, but I don't know of it so it probably doesn't exist...

the ugly and crude thing you could do is poll and move the dialog yourself, but if this is any kind of widely deployed or commercial app that would likely cause more harm than good.

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