|
-
April 16th, 1999, 01:19 PM
#1
Screen Capture into Clipboard?
Hi,
I can't seem to capture my desktop screen and copy it into the clipboard.
When I look at the clipboard the image is totally garbled (black & blue stripes).
Can someone please point out to me what I'm doing wrong or show me
a better way of doing this? I did the following:
<ccode>
HBITMAP hBitmap;
OpenClipboard(hwin); // hwin is my window handle
HDC hDCSrc = GetDC(NULL); // get entire window device context
hBitmap = CreateCompatibleBitmap((HDC) hDCSrc, 640, 480);
SetClipboardData(CF_BITMAP, hBitmap);
ReleaseDC(NULL, hDCSrc);
CloseClipboard();
</ccode>
-
April 16th, 1999, 02:29 PM
#2
Re: Screen Capture into Clipboard?
It appears you may have a type conversion problem.
Check ---> hBitmap = CreateCompatibleBitmap((HDC) hDCSrc, 640, 480);
(what type does this function return?)
-
April 16th, 1999, 04:32 PM
#3
Re: Screen Capture into Clipboard?
> Check ---> hBitmap = CreateCompatibleBitmap((HDC) hDCSrc, 640, 480);
> (what type does this function return?)
It returns an HBITMAP which is what hBitmap is. But the next line:
SetClipboardData(CF_BITMAP, hBitmap) --> the 2nd param is expected to be of HANDLE type.
I pass in an HBITMAP type but if I understand the documentation correctly, this should be ok...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|