comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Q: write to clipboard
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Q: write to clipboard [message #13220] Thu, 22 October 1998 00:00
menakkis is currently offline  menakkis
Messages: 37
Registered: June 1998
Member
Theo Brauers <Th.Brauers@fz-juelich.de> wrote:
> I am looking for simple procedures to write into and
> read from the (WinNT) clipboard directly from IDL.
> like:
> WRITE_CLIPBOARD, ['first line', '2nd']
> a=READ_CLIPBOARD()

This can get quite complex, although maybe not if you only want to work with
strings. Bear with me...

The main problem with clipboard support in IDL, as I see it, is that you
really need to have access to the main, native Windows message loop to do it
properly. Windows does support a few standard clipboard formats which it knows
how to throw away by itself, and if you can go with these then you could come
right in IDL, otherwise you're stuck. (I don't think that you can get at the
Windows message loop in IDL.) I'll try to explain this a bit more...

The clipboard is largely about *sharing* multiple data formats. If you have a
look at what an application like MS Excel sticks onto the clipboard when you
copy a bunch of cells, you'll notice maybe a couple of dozen formats, even
pictures of the cells! Included are the standard Windows formats (like
straight text, bitmap and metafile), but there are numerous other "private",
often more useful formats (like "Csv"). The idea is that Excel can dish out
some format to suit just about any application that can paste from the
clipboard. The problem with the private formats is that Windows won't chuck
them away. All formats use memory. If you have stuck some private formats on
the clipboard and another application comes along wanting to copy to the
clipboard, Windows expects to be able to send you a message saying: "Hey!
Clear your trash off the clipboard!" If your app doesn't respond
appropriately (or hasn't registered these formats properly) then things can go
sick, and the best-case scenario is that memory leaks away. There are some
other kinds of clipboard messages too.

Sorry to bend your ear like this, but I wanted to flesh out the limitations.
Now the good part: If you can make do with copying only the standard formats
then you should be OK. These include straight text, bitmap, metafile, and
even SYLK, I believe. (Check out the Win32 documentation for a full list.)
You can of course paste in anything that you know how to deal with.

I have some basic Copy support in:
ftp://demsyd.syd.dem.csiro.au/pub/mmtg/idl/winclip.zip
Included somewhere in this assortment are routines that copy a bitmap or an
array of strings to the clipboard. I haven't been inclined to do a "paste",
but - tell you what - if you suggest a simple paste operation that you'd like
(e.g., paste in a string array), I might code one up.


Peter Mason

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
[Message index]
 
Read Message
Previous Topic: Re: Changing resolution of CGM file
Next Topic: bug in var_to_dt

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 14:45:51 PDT 2025

Total time taken to generate the page: 1.35795 seconds