MS Windows Clipboard

Alex Martelli aleaxit at yahoo.com
Wed Oct 25 07:16:03 EDT 2000


"Mark Hammond" <MarkH at ActiveState.com> wrote in message
news:nqsJ5.14162$Ab3.72052 at news-server.bigpond.net.au...
> [Alex]
> > [I'd really like to use .GetDesktopWindow() rather than
> > .GetActiveWindow() to create the dummy window's parent,
> > but for some reason win32gui is not exposing GetDesktopWindow
> > in win32all build 135, so I fudged it...]
>
> It will be in 137 ;-)

Thanks!


> > I'm not sure where the standard formats (CF_TEXT, etc)
> > are defined as symbolic constants in win32all -- they're
>
> I've added these to win32clipboard.

Excellent idea!  Thanks again.


> > Calling win32clipboard.GetClipboardData(1) is clearly the
> > way to get at the data we want.  It's documented as
> > returning "the handle of a clipboard object in the specified
> > format", so we might worry about using a PyHANDLE to
>
> Fixed the docs ;-)

A third Very Good Thing.  Although getting the handle might
not be a bad idea either (e.g, for a DragQueryFile I'd like
the bare HDROP...).


> > handy!  Careful, though: the undocumented conversion to
> > string seems to take place somewhat indiscriminately; if
> > asking for format 49159, the FileNameW (clearly meant to
>
> Note that if you ask for CF_UNICODETEXT, you should get back a Unicode
> object.

Oh, good!  But I don't think the CF_UNICODETEXT is among
the available formats when what's on the clipboard is a
file or group of files (CF_TEXT definitely isn't).


> That was a very useful post!  Thanks...

You're most welcome, thank *you* for all the wonderful things
you've done for Python users on Windows, and please feel free
to use the text in that post, or an edited version of it, in
any way you like (as an example of how to approach a Windows
programming task with Python and win32all, for example:-).


Alex






More information about the Python-list mailing list