How to get device context for com object?

Walter Miller wmiller at mediaone.net
Wed Feb 21 17:48:35 EST 2001


That's great!  Yes, it works but I'm also trying to call
CreateCompatibleDC() and it only works with the device context object not
the (int) handle for the device context.  Is there an api for creating a
device context object based on its own handle?

The ultimate plan is to try an replicate the visual basic example of copying
the screenshot of the client portion of the window and saving it as a bitmap
file.  I have an activex control that does this already but that's too
easy - I'm _actually_ trying to learn all the details of using Python with
win32.

> import win32gui
> hdc = win32gui.GetDC(hwnd)
>
> will set hdc to the (int) handle for the device context
> corresponding to (the client areas of) the window whose
> handle is in (int) hwnd.





More information about the Python-list mailing list