Link to home
Start Free TrialLog in
Avatar of Cynna
Cynna

asked on

Screen capture in virtual desktop - 1000 points

Hello,

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 :)
Avatar of Wayne Barron
Wayne Barron
Flag of United States of America image

Cynna;

   It is against the rules of EE to give more then 500-Points "per" question.
https://www.experts-exchange.com/help.jsp#hi4
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.
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';

using:
PrintWindow(FindWindow('Winamp EQ', nil), Image1.Canvas.Handle, 0);
ASKER CERTIFIED SOLUTION
Avatar of ZhaawZ
ZhaawZ
Flag of Latvia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Cynna
Cynna

ASKER

carrzkiss,

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 https://www.experts-exchange.com/help.jsp#hi4 , so
I'm sorry for breaking the rules, will mind my manners in the future :), OK?

---------------------------------------------------------------------------------------------------

Workshop_Alex,

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: www.free-soft.ro , download "Virtual Desktop" with sources.

---------------------------------------------------------------------------------------------------

ZhaawZ,

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).


>  ...you 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 http://members.tripod.com/webdesign123now/java1.htm 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. https://www.experts-exchange.com/help.jsp#hi4

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.
SaLz;

  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.
Avatar of Cynna

ASKER

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.
Avatar of Cynna

ASKER

>... don't give up

The only way to really learn ;)