简体   繁体   中英

Virtual desktop screenshot

I'm creating virtual desktop using interop C#. Then I'm launching few programs within.

Now I need to make screenshots of this desktop from time to time and display it on form. It works fine for current active desktop, but not for created one.

Bitmap screen = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
                          Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
Graphics ss = Graphics.FromImage(screen);
ss.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, 
                  Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);

How can I achieve this goal? It doesn't matter whether I will use .NET functions or WinAPI.

You cannot screenshot the desktop if it is not active. The only thing as I know off is screenshoting the windows and somehow with the position of the windows making the desktop screenshot.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM