Screen capture in virtual desktop - 1000 points


This question is worth 1000 points (after solution, will post another 500 question).

I'd like a working demo that can grab a bitmap of a given window in a virtual desktop.
Demo should function as follows:

1.  Create virtual desktop
2.  Start given application in a virtual desktop (for example, WinAmp) but don't switch to that virtual desktop
3.  Capture the bitmap of "equilizer" WinAmp window and save bitmap to a file while virtual desktop is *not* visible.

Please note that step 3. is core of the problem - I need a working example of how to capture a window
that is opened in a virtual desktop while the user is in another virtual desktop (i.e. not actually
seeing the window that is beeing captured).

Steps 1. and 2.  I can manage, but don't have time right now, thus 1000 points :)
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Wayne BarronAuthor, Web DeveloperCommented:

   It is against the rules of EE to give more then 500-Points "per" question.
Wim ten BrinkSelf-employed developerCommented:
I think this is just a 2-question question. One is "Hi, I am lazy, please write code for 1 and 2, okay?" and the other is "I don't know how to do 3. Who does?"
It should have been split in two posts, though...

And I'm wondering about what a "Virtual desktop" actually is.
ZhaawZSoftware DeveloperCommented:
About step 3 - it could be a problem, if window is minimized or really hidden. If you're using windows 95/98/Me, it still can be a problem. But if using Windows NT/2000/XP and the window is not minimized or actually hidden, you can use function PrintWindow, described in MSDN.

declaring (if needed):
function PrintWindow(SourceWindow: hwnd; Destination: hdc; nFlags: cardinal): bool; stdcall; external 'user32.dll' name 'PrintWindow';

PrintWindow(FindWindow('Winamp EQ', nil), Image1.Canvas.Handle, 0);
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

ZhaawZSoftware DeveloperCommented:
  wnd : hwnd;
  bmp : TBitmap;
  rec : TRect;
wnd := FindWindow('Winamp EQ', nil);
GetWindowRect(wnd, rec);
bmp := TBitmap.Create;
bmp.Width := rec.Right - rec.Left;
bmp.Height := rec.Bottom - rec.Top;
PrintWindow(wnd, bmp.Canvas.Handle, 0);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CynnaAuthor Commented:

Sorry, but I did mention I'll give another 500 in another question, right?
Since two questions are tightly related, it made sense to "connect" them like this.
However,  I didn't read , so
I'm sorry for breaking the rules, will mind my manners in the future :), OK?



Nicely said :), only one slight correction: "don't have time right now" <> "Hi, I am lazy"

> And I'm wondering about what a "Virtual desktop" actually is
Look in Win32.hlp for "CreateDesktop()", "SwitchDesktop()",...etc. function family.
For a demo of how this concept works: , download "Virtual Desktop" with sources.



Thank you for your effort. But...

>  ... if window is minimized or really hidden. If you're using windows 95/98/Me, it still can be a problem
No problem there:
I'm using only XP, and it isn't  - this is exactly the reason of using another desktop (user must NOT see the window,
but capture has to be performed - so place window of another desktop).

> can use function PrintWindow, described in MSDN
This method of screen grabbing is unreliable - it won't work for any given window.
I presume PrintWindow uses WM_PRINT message, because it exibits similar symptoms...

For example, please visit and try
capturing the picture of the game using PrintWindow() method - you'll end up with a gray block.
On the other hand, if you try BitBlt() method, capture will be OK.

I'll give it a few more days for this question. If nobody comes up with the solution,
the 500 points are yours, OK?
>It is against the rules of EE to give more then 500-Points "per" question.

carrzkiss, do u know what else it says in that link u posted.... let me just copy it into here.. "A question is worth whatever it's worth to you." so if the user wants to give more than 500points for a question, then so be it. there was once a time u could give 2000 points, why u think the high points users got so much in couple of years, cos people like this, who are willing to give extra points for the job getting done.

no one wants to answer a question like in this
for a mear 50points if you catchg my drift. so giving extra points is a plus plus.
Wayne BarronAuthor, Web DeveloperCommented:

  The reason I posted the link, is because one of the Admins posted the link
To a post that I was on (Not mine) and told the member that they cannot
Give out no more then "500 Points" per questions.
And they listed that link.
So it is not me, it is EE admins. I am just trying to assist others so that they do not
get into any trouble.
CynnaAuthor Commented:
Well, since nobody except ZhaawZ tried anything, the points are yours ZhaawZ, as promised.

Will probably give it another go in a few days...
that's the spirit, don't give up.
CynnaAuthor Commented:
>... don't give up

The only way to really learn ;)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.