在双监视器设置中的第二台监视器上的全屏预览 [英] Full Screen Preview on a Second Monitor in Dual Monitor Setup

查看:337
本文介绍了在双监视器设置中的第二台监视器上的全屏预览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在为现有的应用程序对话框编写一个添加项.它必须具有以下功能:

当用户点击名为预览应用程序"的按钮时,必须在选定监视器的全屏"中按比例缩放或在黑色背景上显示剪贴板的内容(我知道如何处理剪贴板).它可以是单监视器系统(或处于克隆模式)上的当前监视器,也可以是多监视器设置中指定为预览监视器的应用程序设置中的一个.

我不受编程语言或其他任何限制.我可以通过传递参数(例如监视器,分辨率,缩放比例等)将其与应用程序分开,甚至可以将其预加载并放入系统托盘.

如果您能给我简单的起点,我将不胜感激.

问候,
莫米尔·泽切维奇
Ars Media

Hi folks,

I am writing an add on for existing application dialog based. It has to have following feature:

When user hit button named preview application has to display content of a clipboard (i know how to handle clipboard), Scaled or over the black background, in FullScreen on a selected monitor. It can be current monitor on a single monitor system (or in clone mode), or one that is in application settings designated as preview monitor, in multimonitor settings.

I am not constrained with programming language or anything else. It can be separate application that I call from my application by passing parameters (such as which monitor, resolution , scaling etc), even better if that application can be preloaded and put in system tray.

I would highly appreciate if you can give me easy starting point.

Regards,
Momir Zecevic
Ars Media

推荐答案

您的应用程序不应处理监视器,您只需要避免从一个受监视的旧时使用api来犯一些错误.在剪贴板查看器应用程序中,您要做的就是保存窗口的还原(未最大化)位置,以及保存是否已最大化窗口.当应用程序启动时,它将以其保存的非最大化状态创建窗口,然后,如果用户上次以最大化状态退出程序,则会将窗口设置为最大化.最大化会将窗口自动最大化到包含窗口最大部分的监视器.所以:让用户定位窗口,不要内置想要找出用户想要的烦人的人工智能! :-)如果您的窗口是内置到您的应用程序中的,则执行相同的操作,但是在这种情况下,当usr按下X按钮时,我通常不破坏该窗口,我只需要处理WM_CLOSE并在下一个窗口中隐藏该窗口即可.当我需要它时,我只是将其再次置于可见状态.

注意:创建窗口时,其保存位置可能完全不在屏幕上.一个典型的情况是,将窗口放在辅助监视器上,然后在该监视器分离时重新启动编.如果要处理此类情况,从而在创建窗口之前检查并更正窗口位置,则必须枚举所有监视器,获取监视器的区域,并检查窗口(或至少窗口的标题栏)是否相交与其中一台显示器.如果不是,则将其放到默认位置(假设您将其居中在主屏幕上).如果您不想那么复杂,可以跳过此步骤,但是可以给用户机会重置保存的配置(例如,删除配置文件).如果您坚持要将此位置校正放到编上,则需要使用api: ^ ]和
Your app shouldn''t handle monitors, you just have to avoid making some mistakes by using api from one monitored old times. All you have to do in your clipboard viewer app is saving the restored (not maximized) position of your window, plus saving if its maximized or not. When the app starts it creates the window in its saved non-maximized state, then it sets the window to maximized if the user quit the program in maximized state last time. Maximization will maximize the window automatically to the monitor that contains the biggest part of your window. So: let the user position the window, and don''t build in an annoying artificial intelligence that wants to find out what the user wants! :-) If your window is built-in to your application then do the same thing, but in this case I usually don''t destroy the window when the usr presses the X button, I just handle WM_CLOSE and hide the window an next time I need it I just put it on visible state again.

Note: When you create the window, its saved position might be completely out of screen. A tipical scenario is when you put your window on a secondary monitor and later you restart the prog when that monitor is detached. If you want to handle such cases, thus checking and correcting the window position before creating the window, then you have to enumerate all monitors, get the region of the monitors and check if you window (or at least the titlebar of the window) intersects with one of the monitors. If not, then you put it to a default position (lets say you center it on primary screen). You can skip this step if you don''t want to be that sophisticated but then give the chance to the user to reset the saved config (for example by deleting the config files). If you insist on putting this position correction to your prog then the api you need: EnumDisplayMonitors()[^] and GetMonitorInfo()[^].

Showing the window in maximized state: ShowWindow(hWnd, SW_MAXIMIZE);


这篇关于在双监视器设置中的第二台监视器上的全屏预览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆