How to get device context for com object?
Alex Martelli
aleaxit at yahoo.com
Wed Feb 21 04:29:35 EST 2001
More information about the Python-list mailing list
Wed Feb 21 04:29:35 EST 2001
- Previous message (by thread): How to get device context for com object?
- Next message (by thread): How to get device context for com object?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Walter Miller" <wmiller at mediaone.net> wrote in message news:XuDk6.96953$Wq1.40024851 at nnrp5-w.sbc.net... > That's exaclty what I'm trying to do but don't know how through python - get > the device context based on a window handle. How do I call the GetDC api > through python based on a given window handle? Sorry, this probably should > have been my original question. You need to have installed win32all (or the ActiveState build of Python for Win32, that comes with win32all). Then, 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. Remember to also call win32gui.ReleaseDC(hwnd, hdc) when you're done (you might want to use a try/finally...). (Similarly, you may use win32gui.GetWindowDC to get the hdc for the whole window including non-client areas, &c). Alex
- Previous message (by thread): How to get device context for com object?
- Next message (by thread): How to get device context for com object?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list