Click here to Skip to main content
15,887,862 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

1 solution

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()[^].

EDIT: Showing the window in maximized state: ShowWindow(hWnd, SW_MAXIMIZE);
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900