clipboard

GetClipboardData(CF_TEXT)

独自空忆成欢 提交于 2019-11-27 14:32:54
How to use GetClipboardData(CF_TEXT); without calling and use process id of this in C++? and which libary does GetClipboardData(CF_TEXT) belong to? GetClipboardData() is a Win32 API function. The handle returned by GetClipboardData() must be first locked with GlobalLock() , then you can retrieve the char* pointer of the ANSI text in the clipboard (note that if you want to retrieve Unicode text, you should use the CF_UNICODETEXT format ). A sample code to retrieve the text from the clipboard and store it in a convenient std::string class instance follows (error management omitted for simplicity

How do you copy/paste from the clipboard in C++?

孤者浪人 提交于 2019-11-27 14:05:49
I'm still a C++ newbie who has only recently learned some file manipulation. I looked it up online and the codes given are way beyond my current skill. Is there a simple way to do this, or are there any good tutorials that can explain this from the very basics? In windows look at the following API: OpenClipBoard EmptyClipboard SetClipboardData CloseClipboard GetClipboardData An extensive discussion can be found here . Obviously this topic is strongly operating system related. And if you are using some framework (ie MFC/ATL) you generally find some helper infrastructure. This reply refer to the

Set text and get text from clipboard [closed]

别等时光非礼了梦想. 提交于 2019-11-27 13:00:33
In Android, I need some code to "get text" and "set text" in the clipboard. For example I want to put "asd" in memory and after that paste it from clipboard. ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); clipboard.setText("Text to copy"); clipboard.getText(); 来源: https://stackoverflow.com/questions/6651184/set-text-and-get-text-from-clipboard

Copy files to clipboard in C#

瘦欲@ 提交于 2019-11-27 12:24:34
I have a Windows Forms TreeView (node, subnodes). Each node contains some additional information in its Tag. Also, each nodes maps a file on the disk. What's the easiest way copy/cut/paste nodes/files in C#? It would be nice to have some sample code. Consider using the Clipboard class . It features all the methods necessary for putting data on the Windows clipboard and to retrieve data from the Windows clipboard. StringCollection paths = new StringCollection(); paths.Add("f:\\temp\\test.txt"); paths.Add("f:\\temp\\test2.txt"); Clipboard.SetFileDropList(paths); The code above will put the files

How to write from R to the clipboard on a mac

我们两清 提交于 2019-11-27 11:50:01
问题 I am trying to use the write.table function to write to my clipboard on a mac os system. From other threads, I've tried data <- rbind(c(1,1,2,3), c(1,1, 3, 4), c(1,4,6,7)) clip <- pipe("pbcopy", "w") write.table(data, file="clip") close(clip) This code does not give any error messages, but also does not copy anything to the clipboard. any suggestions? 回答1: I don't have any machine under OS X to test it, but I think you should use just clip instead of "clip" : data <- rbind(c(1,1,2,3), c(1,1,

How to paste on click? It works in google docs

帅比萌擦擦* 提交于 2019-11-27 11:48:35
I want to be able to initiate real paste event when user clicks. I can understand this may be a security issue, because if any webpage had access to users clipboard, that would be bad. So I thought all browsers disallow accessing clipboard data. But for example in google docs (in the word-like application), I can Paste from custom context menu (right mouse click on a html element pretending to be a context menu), even if the clipboard data has been copied to clipboard in different application like Microsoft Paint. This works in Google Chrome browser, which is the browser of my interest. I

HTML5 alternative to flash-based ZeroClipboard for safe copying of data to clipboard?

拥有回忆 提交于 2019-11-27 11:31:58
With flash on the way out in many environments (iPhone, Android, IE10, etc...), is there any new solution forthcoming in any browsers that will allow a safe copy of information to the clipboard without flash installed? I've been using ZeroClipboard so far, but I'm worried about more viewers that don't have flash and this functionality is going to be broken and I'd love to not depend on Flash whenever possible. Beau Bouchard The reasoning is that automatic copying to clipboard can be very dangerous, thus most browsers (except IE)* make it difficult unless you use flash. Much like your

How do I get the selected text from the focused window using native Win32 API?

老子叫甜甜 提交于 2019-11-27 11:23:26
My app. will be running on the system try monitoring for a hotkey; when the user selects some text in any window and presses a hotkey, how do I obtain the selected text, when I get the WM_HOTKEY message? To capture the text on to the clipboard, I tried sending Ctrl + C using keybd_event() and SendInput() to the active window ( GetActiveWindow() ) and forground window ( GetForegroundWindow() ); tried combinations amongst these; all in vain. Can I get the selected text of the focused window in Windows with plain Win32 system APIs? TL;DR: Yes, there is a way to do this using plain win32 system

How to handle a blocked clipboard and other oddities

偶尔善良 提交于 2019-11-27 11:01:34
Over the course of the last couple of hours I have been tracking down a fairly specific bug with that occurs because another application has the clipboard open. Essentially as the clipboard is a shared resource (as per "Why does my shared clipboard not work?" ) and you attempt to execute Clipboard.SetText(string) or Clipboard.Clear(). The following exception is thrown: System.Runtime.InteropServices.ExternalException: Requested Clipboard operation did not succeed. at System.Windows.Forms.Clipboard.ThrowIfFailed(Int32 hr) at System.Windows.Forms.Clipboard.SetDataObject(Object data, Boolean copy

Trigger an event when clipboard content changes

怎甘沉沦 提交于 2019-11-27 10:24:35
问题 I'm trying to get the clipboard content using a Python script on my Mac Lion. I'm searching for an event or something similar, because if I use a loop, my application spends all its time watching the clipboard. Any ideas? 回答1: Have you thought about using an endless loop and "sleeping" between tries? I used pyperclip for a simple PoC and it worked like a charm, and Windows and Linux. import time import sys import os sys.path.append(os.path.abspath("SO_site-packages")) import pyperclip recent