Sorry, I don't know which topic to ask this question. In that programming language section, I 'd like to ask it all. There are always people who understand it! For example, if I copy the content of a webpage, including text and images, paste it into *. in txt, It is pasted as a pure string...
Sorry, I don't know which topic to ask this question. In that programming language section, I 'd like to ask it all. There are always people who understand it!
For example, if I copy the content of a webpage, including text and images,
If you paste it into a *. txt file, it is a pure string;
If he is pasted into a Word document, he is a prepared text that contains html tags and css styles;
If you paste it into the QQ chat window, it is an image + string,
I don't understand what is in my clipboard?
What encoding does this thing use?
In fact, the purpose of this question is to re-code the clipboard ..
Reply content:
Sorry, I don't know which topic to ask this question. In that programming language section, I 'd like to ask it all. There are always people who understand it!
For example, if I copy the content of a webpage, including text and images,
If you paste it into a *. txt file, it is a pure string;
If he is pasted into a Word document, he is a prepared text that contains html tags and css styles;
If you paste it into the QQ chat window, it is an image + string,
I don't understand what is in my clipboard?
What encoding does this thing use?
In fact, the purpose of this question is to re-code the clipboard ..
For the HTML of the webpage, Notepad ++ has the html paste option.
You can understand that what you copy is an Object, and what you paste into it depends on what the target software obtains from your Object.
It should be binary in essence.
On windows, you can directly retrieve audio, images, or text objects by calling different methods.
If the web page is accessed, it should be a string.
If. net is used, you can use the System. Windows. Clipboard class.
When copying a webpage, Clipboard. GetText (TextDataFormat. Html) should be able to retrieve the html string
Specific reference MSDN: https://msdn.microsoft.com/zh-cn/library...
It seems that the Clipboard contains html, text, and image content on your webpage, because when you select a part of the page, you can use F12 to open debugging and you can see it in the html code, the corresponding code is also selected, while notepad only displays plain text, because it cannot read image links and html tags, and the world document can read image paths, as is qq.
For Web pages, the html source code of the selected part should be copied. As for what the output will look like, it is explained by the software you are using. Similarly, if you copy a file and paste it into word as a reference, paste it into the text box as a file name; if you copy multiple lines of text and paste it into a single-line text box, you may only keep the first line, or all linefeeds may be lost and merged into one line.
The clipboard gets and pastes memory variables during a program running.
The difference is that your target program has different reading capabilities.
Coincidentally, yesterday I also wanted to get something and reverse all the content in the clipboard before outputting it. However, I encountered various Encoding Problems and image conversion. Mark.
How many clipboard are there in your notebook? But I don't know how the clipboard works. I searched for Stack Overflow. This link may be helpful: Clipboard Operations (Windows ). As mentioned in Paste Operations, the system clipboard can export different formats. You can set your own pasting format in a window. For example, you can only obtain text content in notepad, word can also obtain the image, text format, and so on.
Besides, the clipboard of different operating systems is different. For example, copying a file under Linux actually copies the file path ...... And Windows.
For Clipboard, all answers may be provided here: hluk/CopyQ: Clipboard manager with advanced features. The installation has been tried, and the effect is good. Everything copied from Word and the web page can be displayed quite well:
Other reference links:
Stores a data structure.
For details, see setting clipboard content in windows api.
The following is a discussion of Win32. @ Aristotll mentioned Notepad ++'s selective pasting in the answer, so I found the corresponding source code as shown in the following figure:
case IDM_EDIT_PASTE_AS_RTF:case IDM_EDIT_PASTE_AS_HTML:{ LongRunningOperation op; UINT f = RegisterClipboardFormat(id==IDM_EDIT_PASTE_AS_HTML?CF_HTML:CF_RTF); if (!IsClipboardFormatAvailable(f)) return; if (!OpenClipboard(NULL)) return; HGLOBAL hglb = GetClipboardData(f); if (hglb != NULL) { LPSTR lptstr = (LPSTR)GlobalLock(hglb); if (lptstr != NULL) { // Call the application-defined ReplaceSelection // function to insert the text and repaint the // window. _pEditView->execute(SCI_REPLACESEL, 0, (LPARAM)lptstr); GlobalUnlock(hglb); } } CloseClipboard();}break;
It can be seen that the clipboard format is not limited, but can be customized using RegisterClipboardFormat. For more details, refer to the relevant information on MSDN.
Clipboard is a part of a computer disk (previously encountered when studying Computer Basics). It should be saved in binary format. paste the clipboard to see the support of the Software. For example, there is a limit on access to clipboard on a webpage, qq and office are local software with higher permissions, so the content is completely transparent.