Running an application on a "virtual desktop" with redirected user input and graphical output

548 views Asked by At

I want to render the visual apperance (live) of certain applications/window to a direct x mesh object. For example, let's say I want to render the internet explorer with a certain page opened to a rectangle in direct x.

What I need for that is a screenshot of the application. Later, I want to also redirect mouse or user input to the application, so that it can be steered from the direct x application. So I need a possibility to start a application, not visible (since the main direct x program is running on screen), and want to grab a screenshot of it's current look. This image/program snapshot can be rendert to a direct x object.

I tried certain models:

  • I created a virtual desktop (API CreateDesktop). Here, i can start my application. But it is not possible to create a screenshot, when this virtual screen is not visible! Since I use a time critical direct x application, it is no option for me to switch to the virtual desktop, grab a screenshot, and come back. Since i want to start more than one applications (for example more internet explorers, e-mailing, notepad, etc...) this is also not a good idea.

  • I tried to start the application hidden on current screen. Same problem: I cannot grab a screenshot (with PrintWindow(IntPtr hWnd, IntPtr hdcBlt, int nFlags) API I can grab screenshot providing a handle. But if the application is hidden, no Process.MainWindowHandle for the process is created - this is the same problem I noticed with the virtual screens).

The whole scenario has to work somehow (see terminal server).

Does anybody have an idea, how to realise this?

Operating system: Windows 7, Language: C#

Best regards

1

There are 1 answers

0
radzaw On

It's impossible to make a screenshot of another desktop or hidden apps - they will not be drawn to any device, because there is no need for that and it saves CPU/GPU power. Only one desktop can be visible (and that desktop will be rendered) and receive input at one time.

You can always switch between desktops.

Another option is to hook to windows/directx dlls and capture functions calls, but thats a lot of work ;)