Updated 2017-03-08 10:35:36 by jdc

Tried on Window 2000 Pro, AS Tcl 8.4.6, TWAPI 0.8. Put image on clipboard via Alt-PrntScrn. The image pastes into MSpaint fine. When I push paste on this test program the process just disappears with no message or error display of any kind. :*( RT, 26March2006. To install the patched Img I simply copied the zip files over top of existing Img install. Was that correct? (I did this because the zip did not contain a full compliment of files) Update by RT, 30June06 - finally tried with 8.4.9 (ActiveState) and the new Img is indeed working to load the .bmp file created by the Clipboard2Img proc below. Thanks!

PO 2006/03/26 The Zip file should contain everything you need. But, I've compiled the Img extension against Tcl 8.4.9. This may be your problem; Stubs are only upwards compatible.

APN Both copy and paste worked fine for me on XP SP2 in 16 and 32 bit display modes. Tcl 8.4.12, TWAPI 0.8. Unlike the above user, I removed by original Img directory and just used the above version instead.

MG I used a simplified version of this code on XP SP2 for pasting PNG images for different Excel objects (charts, equations) from the clipboard directly to Tk canvas. Tcl 8.4.11, TWAPI 0.8 and a standard Img1.3. My code follows after the main example.

DC Paul, did you ever post a patch file or the source code to this modification?

MR Did not work for me on WinXP, Tcl 8.4.9, TWAPI 0.8. Getting this error: couldn't load library "Img1.3/tkimgwindow13.dll": this library or a dependent library could not be found in library path while executing.

PO 2006/09/19 The Img package available from my homepage is dependent on msvcrtd.dll. It was intended as a test/debug version.

The patched sources of the BMP parser are in the SF repository since 2006/06/06. It could therefore be part of an actual AS distribution.

[potrzebie] - 2011-11-15 07:46:28 The test code works directly with latest ActiveTCL, so I guess they included your extended BMP parser.

Just copy image to clipboard

(extract from below)

  • requires twapi and Img (at least tkimg files pkgIndex.tcl, tkimg14.dll, tkimgbmp14.dll)
  • Image is named Img (image create photo Img)
package require twapi_clipboard
package require img::bmp
twapi::open_clipboard
twapi::empty_clipboard
# First 14 bytes are bitmapfileheader - get rid of this
twapi::write_clipboard 8 [string range\
        [binary decode base64 [Img data -format bmp]] 14 end]
twapi::close_clipboard