Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: How to "Set" unicode text to Win32::Clipboard?

by Util (Priest)
on Apr 30, 2011 at 22:34 UTC ( #902266=note: print w/replies, xml ) Need Help??

in reply to How to "Set" unicode text to Win32::Clipboard?

If my reading of Clipboard.xs in the Win32::Clipboard source is correct, then the module does *not* have any way to make Set() work as anything but CF_TEXT. The docs even explicitly say about CF_TEXT:

this is the only format you can use to set clipboard data


  1. Submit a request via to add this functionality.
  2. Edit the source to make a SetAs() routine, by combining techniques from GetAs() and Set(). Don't forget to send a patch to Jan Dubois.
  3. Use Win32::API to directly access SetClipboardData(CF_UNICODETEXT, Data) and related APIs.
  4. Pay someone to do #2 or #3.

  • Comment on Re: How to "Set" unicode text to Win32::Clipboard?

Replies are listed 'Best First'.
Re^2: How to "Set" unicode text to Win32::Clipboard?
by Dr. Mu (Hermit) on May 01, 2011 at 00:15 UTC
    Thanks, yes, I saw that in the doc about CF_TEXT; but the same doc also states that CF_UNICODETEXT is a constant that's "not recognized by Win32:Clipboard," which is untrue. So I was hoping the doc was wrong here, as well, and that there was an easy way around the issue.

    Options 2 and 3 are more than I care to dig into right now. But since I'm using Win32::GuiTest I might also look into using its WMSetText method to write the text directly to the textarea, instead of going through the clipboard. Wish me luck!

    Thanks again,

      Unfortunately, WMSetText doesn't work like I thought it would with the text in the edit window. However, I've been able to work around the problem by saving the marked-up text to a file and causing the other program to load that file, instead of going back through the clipboard. It's ugly (the open file dialog box flashes on momentarily -- yuck!), but it works.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://902266]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2018-02-21 04:19 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (274 votes). Check out past polls.