Tell windows which monitor to display dialogs on
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 mous开发者_如何学Ce 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
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.
精彩评论