Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 26 |
Nodes: | 6 (0 / 6) |
Uptime: | 51:33:55 |
Calls: | 632 |
Files: | 1,187 |
D/L today: |
21 files (18,502K bytes) |
Messages: | 178,040 |
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
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-a # \param action one of the strings "copy" or "cut"
-a-a # \return
proc ::ClipboardSetAction {action} {
-a-a if {[string equal -nocase $action "copy"]} {
-a-a-a-a set hex 05000000
-a-a } elseif {[string equal -nocase $action "cut"]} {
-a-a-a-a set hex 02000000
-a-a } else {
-a-a-a-a set hex 05000000
-a-a }
-a-a set bin [binary decode hex $hex]
-a-a set id [::twapi::register_clipboard_format "Preferred DropEffect"]
-a-a ::twapi::open_clipboard
-a-a ::twapi::write_clipboard $id $bin
-a-a ::twapi::close_clipboard
}
*** START OF ERROR MESSAGE ***
Unsupported format 49474.
*** ERROR INFO ***
Unsupported format 49474.
-a-a-a-a while executing
"error "Unsupported format $fmt.""
-a-a-a-a (procedure "_check_if_global_memory_format" line 8)
-a-a-a-a invoked from within
"_check_if_global_memory_format $fmt"
-a-a-a-a (procedure "rethrow" line 2)
-a-a-a-a invoked from within
"rethrow"
-a-a-a-a invoked from within
"trap {
-a-a-a-a-a-a-a-a _check_if_global_memory_format $fmt
-a-a-a-a-a-a-a-a # For byte arrays, string length does return correct size >> -a-a-a-a-a-a-a-a # (DO NOT USE string byt..."
-a-a-a-a (procedure "_write_clipboard" line 4)
-a-a-a-a invoked from within
"_write_clipboard $fmt $data"
-a-a-a-a invoked from within
"trap {
-a-a-a-a-a-a-a-a _write_clipboard $fmt $data
-a-a-a-a } onerror {TWAPI_WIN32 1418} {
-a-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-a-a (procedure "::twapi::write_clipboard" line 2)
-a-a-a-a invoked from within
"::twapi::write_clipboard $id $bin"
-a-a-a-a (procedure "::meshparts::ClipboardSetAction" line 12)
-a-a-a-a invoked from within
"::meshparts::ClipboardSetAction "copy""
-a-a-a-a (procedure "::meshparts::ExplorerCopy" line 7)
-a-a-a-a invoked from within
"::meshparts::ExplorerCopy"
-a-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