Is is possible to show an application on only one display, if the display is cloned? My goal is to develop a timer that is shown on the laptop display during a presentation but not on the projector.
I'm looking for something like windows' "Identify displays" feature, which displays numbers 1 and 2 on the different displays, even in cloned mode.
Thanks
Edit
I discovered a possible duplicate to this question. The accepted answer in this case was to use Screens.AllScreens
to discover the number of screens. This is not enough in my case. A comment on the accepted answer links to a thread about directly painting on the desktop. I tried this with the following code, but the text appeared on both displays. The code to get the Hdc of the input is from an article about screen captures. I'm not sure what to set for the other parameters (they are IntPtr.Zero in the article)
[DllImport("gdi32.dll")]
static extern IntPtr CreateDC(IntPtr lpszDriver, string lpszDevice, IntPtr lpszOutput, IntPtr lpszInitData);
[DllImport("gdi32.dll")]
static extern IntPtr DeleteDC(IntPtr hdc);
private void PaintOnDesktop(string stringToPrint, Font font, Brush brush, PointF position) {
string deviceName = Screen.AllScreens[0].DeviceName;
IntPtr targetHdc = CreateDC(IntPtr.Zero, deviceName, IntPtr.Zero, IntPtr.Zero);
using (Graphics g = Graphics.FromHdc(targetHdc)) {
g.DrawString(stringToPrint, font, brush, position);
}
DeleteDC(targetHdc);
}
Edit 2
Apparently there is no way to do this in C#, so I changed the C# tag to device driver.
The only way to achieve this effect would be to "clone" the screen "manually", i.e. outside of utilizing this feature of the driver, which would of course induce some lag. UltraMon has a feature like this, designed for video cards or OS's that don't support multiple-monitor cloning. It's basically done by screenshotting the desktop rapidly and displaying it on a form on another (extended) monitor.
The lag induced is only present on one of the monitors, so in your case if this is for a presentation, I would suggest making "your" monitor (probably the primary one on your laptop) the recipient of the lag, so the audience doesn't see it. You can then of course draw a timer form on top of either screen.