Menu

#224 Error writing RTF to clipboard

Unscheduled
closed
nobody
None
Bug
5
2025-08-16
2025-08-10
No

In TWAPI 5.1.0 running with Tcl 9.0.2 on Windows 11, writing RTF to the clipboard generates the following error:

Unsupported format 49311.

The following script demonstrates the error:

package require twapi

set RTF {
{\rtf1\ansi
{\fonttbl
{\f0 Segoe UI;}
}
{\colortbl
\red0\green0\blue0;
\red255\green255\blue255;
}
\ql\f0\fs20 \cf0\cb1\chcbpat1 Hello, World!}
}

::twapi::open_clipboard
::twapi::empty_clipboard
set format [::twapi::register_clipboard_format "Rich Text Format"]
::twapi::write_clipboard $format $RTF
::twapi::close_clipboard

Version 5.0.2 and 4.7.2 work as expected.

Discussion

  • Ashok P. Nadkarni

    You need to now call clipboard_format_uses_global_heap passing it the format before the first call to read/write_clipboard. The reason for the change is at noted at https://github.com/apnadkarni/twapi/issues/16.

     
  • Tim Tomkinson

    Tim Tomkinson - 2025-08-11

    That worked great. Thanks!

     
  • Ashok P. Nadkarni

    • status: open --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB