[python-win32] Screenshot a given window instead of the whole desktop
Michael C
mysecretrobotfactory at gmail.com
Mon May 1 02:14:48 EDT 2017
I solved that problem already, i sould have told everyone here, sorry
On Sun, Apr 30, 2017 at 11:13 PM Tim Roberts <timr at probo.com> wrote:
> On Apr 28, 2017, at 5:40 PM, Michael C <mysecretrobotfactory at gmail.com>
> wrote:
>
>
> I have my own code that samples pixel colour,
> https://pastebin.com/4EMd765h
>
> and now I am trying to add the feature of saving the Device Context to a
> .bmp file, so I found this code
>
> https://books.google.ca/books?id=9MS9BQAAQBAJ
>
> however there is one problem: The book example screenshots the whole
> desktop and I only want a screenshot of a given window. Is there a way to
> modify the black hat example into something that only screenshot a window
> given its handle?
>
>
> It would have been easier to help if you had showed us the code you're
> trying to modify.
>
> I assume the code you're copying does GetDC(0) to grab a DC for the
> desktop. If you instead pass the window handle of the window you want to
> snapshot, just pass that to GetDC. You'll want to use GetWindowRect to
> find the size of the window.
> —
> Tim Roberts, timr at probo.com
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> https://mail.python.org/mailman/listinfo/python-win32
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20170501/f8309248/attachment-0001.html>
More information about the python-win32
mailing list