Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Update: Read *and* Write images against Windows Clipboard

From: greggirwin:mindspring at: 22-Sep-2002 11:55

Hi Scott, << When I peruse the raw rebol executable, I actually can find that many of these routines are called from within REBOL (not GetDIBIts though). We (the list people) have previously been under the impression that clipboard:// can only read and write text from/to the clipboard. So the mystery for me is, why are these function calls there? >> There are a number of related APIs that would be used for many other purposes beyond clipboard support. It's hard to write a Windows app without using a certain number of API calls just to accomplish basic tasks. The clipboard specific calls would be used for text support that the clipboard:// scheme allows today. << I began to wonder how it is we knew about the clipboard:// scheme to begin with. As far as I can tell, it started in the /View beta days, and is currently only "documented" on the rebolforces website, and, of course, it comes up on the list on occasion. >> A few places mention it. I think Brett does on CodeConscious, and the Clipboard reblet in IOS is a prominent example. I don't know if it's in any offical docs though, so I'm not sure how it came to light either. << By the way, what little I can see, it seems as though other broadly cross-platform solutions avoid using binary through the clipboard. REBOL does not stand alone on this issue. >> And I can see why! The approach I've taken for this first whack is very simplistic and, as I already posted, may not work correctly if an app pastes from the DIB format in the clipboard rather than the BITMAP format. The API I'm calling is easy to use - but obsolete (not even sure if XP supports it), and the simple approach of using CreateBitmap and limiting things to single plane bitmaps using 32 bits per pixel is probably not acceptable as a robust solution for a product. If I were to expand this to be up to date, with broad support for any type of image that might be used, the code base could easily be 50 times as large. There are at least three versions of the BITMAPINFOHEADER structure now, with varying support for things like compressed images (e.g. JPG), depending on which version of Windows you're on, and some APIs even work differently depending on *how* a bitmap was created! AAAaaahhh!! :) Ultimately, I much prefer the idea of something like the ARexx ports Jason mentioned. A portable way to programmatically talk between apps. Writing lots of little apps makes much more sense when you can link them up via a simple IPC mechanism to perform big tasks. Brett (I think) started playing around with something on this a while back (play-apps), but I don't remember how far he got. Integrating apps on Windows is not always easy. In the old days DDE was king, then OLE, then COM, and always you could pump messages, send keystrokes, and use the clipboard. There has never been a single, simple, long-term solution to the problem though. I'm using the latter three because they are kind of a "lowest common denominator". Pumping messages is easy enough, provided you can find out what the messages are that you need to send. Sending keystrokes is a bit more involved, but my send-keys dialect seems to be working pretty well (anybody care to test it? :). Now the basic clipboard stuff is there, so I can automate things pretty well in order to integrate them with the REBOL pieces. It may be low tech, but it works. Sorry for rambling! I hope I answered your question in there somewhere. :) --Gregg