clipboard

Copy binary data to clipboard

一笑奈何 提交于 2019-11-29 14:31:17
How can I copy binary data in the clipboard? For example if I pack the number 1 as a 4-byte little-endian integer I want my clipboard to show 00 00 00 01 For text data this is trivial, with the option of having unicode text or ascii text. Clipboard.SetData(DataFormats.Text, "Some text"); Clipboard.SetData(DataFormats.UnicodeText, "赤"); However for binary data I don't know what to do. There are actually two ways to do this: First one, and by far the simplest one: you simply put the byte array into the clipboard. This will automatically serialize the byte array, and deserialize it on retrieve,

Copy empty string using Clipboard.SetText(string)

你。 提交于 2019-11-29 14:00:01
Clipboard.SetText("") throws me an error - "Value cannot be null". So how do I copy an empty string using Clipboard.SetText ? I have already done Clipboard.Clear() . It does clear the clipboard, but it doesn't help me to paste an empty string Any suggestions? Bull If you try to save null or an empty string using Clipboard.SetText it will never work. See Clipboard.SetText Method (String) (MSDN). It mentions ArgumentNullException is thrown if the text is null or Empty for Clipboard.SetText . Hence you cannot achieve what you are trying to achieve. I think you need to do Clipboard.Clear() From

Clipboard access using Javascript - sans Flash?

一笑奈何 提交于 2019-11-29 13:39:06
Is there a reliable way to access the client machine's clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use Flash? My primary target is IE8, but would like to support FF and Chrome also. I have seen the technique to do this using Flash, but am looking for a pure js route: Clipboard access using Flash Since this is a big security risk, all browsers that care about safety don't allow JS to access the clipboard. The main reason is that many people put their passwords into a text file and then use cut&paste to

Make clipboard copy-paste work on iphone devices

醉酒当歌 提交于 2019-11-29 12:43:48
问题 I have web application, which is mostly designed to be run on mobile devices. I have one button, which will copy to device clipboard the passed text. I am using javascript for that. My code is working great on all mobile devices, except for iphone and ipad. Anybody knows what can be the problem? Here is my code: CopyToClipboard = function(text, fallback){ var $t = $('<textarea />'); $t.val(text).appendTo('body'); $t.select(); document.execCommand('copy'); $t.remove(); return true; }; I have

How does a CRichEditCtrl know a paste operation has been performed?

人走茶凉 提交于 2019-11-29 11:48:07
It has methods like CRichEditCtrl::Copy() , CRichEditCtrl::Paste() which you can call, but I can't spot any messages the control is sent by Windows telling it to perform a paste operation. Does anyone know if such a thing exists? Or does CRichEditCtrl do something lower-level like monitoring WM_CHAR events? If so can I reuse any internal methods or would I just have to roll my own in order to override the standard paste functionality? What I actually want is for my custom subclass ( CMyRichEditCtrl : CRichEditCtrl ) to ignore any formatting on text pasted in to the control. Either by getting

Requested Clipboard operation did not succeed

淺唱寂寞╮ 提交于 2019-11-29 11:46:18
问题 Exception Type: ExternalException Message: Requested Clipboard operation did not succeed. Method: ThrowIfFailed Source: System.Windows.Forms Stack Trace: at System.Windows.Forms.Clipboard.ThrowIfFailed(Int32 hr) at System.Windows.Forms.Clipboard.SetDataObject(Object data, Boolean copy, Int32 retryTimes, Int32 retryDelay) at System.Windows.Forms.Clipboard.SetText(String text, TextDataFormat format) at System.Windows.Forms.Clipboard.SetText(String text) at Deerfield.Base.Controls.DataGridView

C# Clipboard.GetText()

試著忘記壹切 提交于 2019-11-29 11:29:08
问题 How can I get the clipboard text in a non static thread? I have a solution but I'm trying to get the cleanest/shortest way possible. The results turn up as an empty string when calling it normally. 回答1: I would add a helper method that can run an Action as an STA Thread within a MTA Main Thread. I think that is probably the cleanest way to achive it. class Program { [MTAThread] static void Main(string[] args) { RunAsSTAThread( () => { Clipboard.SetText("Hallo"); Console.WriteLine(Clipboard

Copy image to clipboard in Python3

六眼飞鱼酱① 提交于 2019-11-29 10:38:58
First of all, the question on SO copy image to clipboard in python leads to answer Write image to Windows clipboard in python with PIL and win32clipboard? , which was only good for Python 2.x. -- I tried it and it didn't work. I overcame one problem: StringIO and cStringIO modules are gone in Python 3.0: , but bumped into another one: TypeError: string argument expected, got 'bytes' Hence, re-asking the same question again for Python 3 -- How to copy image to clipboard in Python 3? Here is the code I've got so far: from io import StringIO import win32clipboard from PIL import Image def send_to

Why do I not see the Microsoft Forms 2.0 Object Library?

a 夏天 提交于 2019-11-29 10:21:27
I would like to use this library to work with the clipboard. I expect to see it as in the screenshot below, but I can't find it in my list of reference libraries. How can I make it appear? If you add a UserForm to your project, the library will get automatically added. If you don't need the UserForm, you can always delete it later. 来源: https://stackoverflow.com/questions/35610429/why-do-i-not-see-the-microsoft-forms-2-0-object-library

How to copy/cut a file (not the contents) to the clipboard in Windows on the command line?

大憨熊 提交于 2019-11-29 09:46:41
Is there a way to copy (or cut) a file to the Windows clipboard from the command line? In particular with a batch script. I know how to copy the contents to the clipboard ( type file | clip ), but this is not the case. I want to have the whole file as I would press Ctrl + C in Windows Explorer. OK, it seems the easiest way was to create a small C# tool that takes arguments and stores them in the clipboard: using System; using System.Windows.Forms; using System.Collections.Generic; using System.Collections.Specialized; namespace File2Clip { public class App { [STAThread] static void Main(string