How to get device context for com object?

Alex Martelli aleaxit at
Tue Feb 20 15:10:12 EST 2001

"Walter Miller" <wmiller at> wrote in message
news:NVxk6.15$uj7.15036 at
> Anyone know how to get a device context for a com object?  For example:

There is no general way: the COM object might have/use any
number of windows, from 0 upwards, at any given time, and/or
other devices, so it's not clear at all what 'a device context for
the object' might mean (what does it mean to get a device
context for a process, or a thread, or a DLL, or...?).

Some specific COM interface for which it makes sense will
implement a GetDC method, of course (offhand, though, only
IDirectDrawSurface3 comes to mind -- which doesn't help
you much with an internet explorer application object!-)

Other will let you get a handle to a window object (again
only one comes to mind, IOleWindow, but that one has
several derivatives, and is used heavily in the in-place
activation protocol, so it _may_ be possible, with a little
bit of effort, to get *that* one for internet explorer -- if
you activate it in-place within a container of yours, or use
it as the container for your own activex control's in-place


More information about the Python-list mailing list