From Newsgroup: comp.lang.tcl
See
https://sourceforge.net/p/twapi/bugs/224/.
On 9/19/2025 12:11 PM, meshparts wrote:
I have a function (see below) that is part of another function that puts
one of more files into the Windows clipboard.
This function used to work with Tcl 8 and TWAPI 4.6.0.
Now with Tcl 9 and TWAPI 5.1.1 it throws the error below.
Any ideas how to fix this?
## Set the action to be performed on paths in the clipboard ("copy" or "cut").
-a # \param action one of the strings "copy" or "cut"
-a # \return
proc ::ClipboardSetAction {action} {
-a if {[string equal -nocase $action "copy"]} {
-a-a-a set hex 05000000
-a } elseif {[string equal -nocase $action "cut"]} {
-a-a-a set hex 02000000
-a } else {
-a-a-a set hex 05000000
-a }
-a set bin [binary decode hex $hex]
-a set id [::twapi::register_clipboard_format "Preferred DropEffect"]
-a ::twapi::open_clipboard
-a ::twapi::write_clipboard $id $bin
-a ::twapi::close_clipboard
}
*** START OF ERROR MESSAGE ***
Unsupported format 49474.
*** ERROR INFO ***
Unsupported format 49474.
-a-a-a while executing
"error "Unsupported format $fmt.""
-a-a-a (procedure "_check_if_global_memory_format" line 8)
-a-a-a invoked from within
"_check_if_global_memory_format $fmt"
-a-a-a (procedure "rethrow" line 2)
-a-a-a invoked from within
"rethrow"
-a-a-a invoked from within
"trap {
-a-a-a-a-a-a-a _check_if_global_memory_format $fmt
-a-a-a-a-a-a-a # For byte arrays, string length does return correct size
-a-a-a-a-a-a-a # (DO NOT USE string byt..."
-a-a-a (procedure "_write_clipboard" line 4)
-a-a-a invoked from within
"_write_clipboard $fmt $data"
-a-a-a invoked from within
"trap {
-a-a-a-a-a-a-a _write_clipboard $fmt $data
-a-a-a } onerror {TWAPI_WIN32 1418} {
-a-a-a-a-a-a-a # Caller did not have clipboard open. Do it on its behalf
-a-a-a-a-a ..."
-a-a-a (procedure "::twapi::write_clipboard" line 2)
-a-a-a invoked from within
"::twapi::write_clipboard $id $bin"
-a-a-a (procedure "::meshparts::ClipboardSetAction" line 12)
-a-a-a invoked from within
"::meshparts::ClipboardSetAction "copy""
-a-a-a (procedure "::meshparts::ExplorerCopy" line 7)
-a-a-a invoked from within
"::meshparts::ExplorerCopy"
-a-a-a (command bound to event)
*** ERROR STACK ***
INNER:returnImm {Unsupported format 49474.} {} CALL:_check_if_global_memory_format 49474
CALL:_write_clipboard 49474
--- Synchronet 3.21a-Linux NewsLink 1.2