Hi!
Can I save and restore the content of the clipboard without dealing with
the format it stores? I use the clipboard for data exchange between
applications (this is the only way), and I would like to keep the
previous content of the clipboard. Any examples I've found build on the
format of the data, but I can't now in advance, what type of data on the
clipboard will be. I can't even save and restore a part of simple
formatted text copied from winword. If I choose text format, I get
unformatted text back. If I choose Rich Text Format, I get the rtf
formatting text (eg. "{\rtf1\ansi\an sicpg1250\uc1\d eff0\" ..., but not
the formatted text.
IDataObject ido = Clipboard.GetDa taObject();
object savedData = ido.GetData(Dat aFormats.Rtf, true);
....Using clipboard for data exchange
Clipboard.SetDa taObject(savedD ata, true);
And what if there is a bitmap or other kind of data on the clipboard?
How could I save and restore them?
Could someone send me a link where I could find solution for my problem,
or tell me what I could do?
Thank's
Tamas Meszaros 2 4312
Mészáros,
Once you get the implementation of IDataObject, you should be able to
call GetFormats to get all the formats that are on the clipboard. Once you
have those, cycle through them, and get the data, and store it somewhere.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Mészáros Tamás" <me*****@sch.bm e.hu> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. .. Hi!
Can I save and restore the content of the clipboard without dealing with the format it stores? I use the clipboard for data exchange between applications (this is the only way), and I would like to keep the previous content of the clipboard. Any examples I've found build on the format of the data, but I can't now in advance, what type of data on the clipboard will be. I can't even save and restore a part of simple formatted text copied from winword. If I choose text format, I get unformatted text back. If I choose Rich Text Format, I get the rtf formatting text (eg. "{\rtf1\ansi\an sicpg1250\uc1\d eff0\" ..., but not the formatted text.
IDataObject ido = Clipboard.GetDa taObject(); object savedData = ido.GetData(Dat aFormats.Rtf, true); ...Using clipboard for data exchange Clipboard.SetDa taObject(savedD ata, true);
And what if there is a bitmap or other kind of data on the clipboard? How could I save and restore them?
Could someone send me a link where I could find solution for my problem, or tell me what I could do?
Thank's
Tamas Meszaros
Hi, I've found build on the format of the data, but I can't now in advance, what type of data on the clipboard will be. I can't even save and restore a part of simple formatted text copied from winword.
ido.GetFormats( true) returns a string-array of all supported datatypes.
You can iterate through them and decide which one to choose.
If I choose text format, I get unformatted text back. If I choose Rich Text Format, I get the rtf formatting text (eg. "{\rtf1\ansi\an sicpg1250\uc1\d eff0\" ..., but not the formatted text.
string stemp = Clipboard.GetDa taObject().GetD ata("Rich Text
Format").ToStri ng();
DataObject data = new DataObject();
data.SetData(Da taFormats.Rtf, s);
System.Windows. Forms.Clipboard .SetDataObject( data,true); This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: xyz |
last post by:
I have a menu item to handle clipboard actions (cut, copy, paste).
When I paste text that I copied from a Hungarian web page, the display
looks normal on my RichTextBox, but the text retrieved from the
clipboard is corrupted. For example, a U with double accent ( byte
code x'FB' ) is replaced by a question mark in my txtEdit.Text after a
Paste operation.
It seems that the Clipboard.GetText() is changing the data.
How is it possible to...
|
by: LG |
last post by:
Just have a question with regards to the clipboard, and how to read what
other applications (Adobe InDesignCS) place in the clipboard.
I am currently in the process of creating a booklet from a database, and I
need the data to be laid out in a tabular format, and set out in a specific
way. At the current point in time, I am copy/pasting the raw text from the
database into a table layout in InDesign. What I was thinking is that if I
could...
|
by: lgbjr |
last post by:
Hello All,
I¡¯m using a context menu associated with some pictureboxes to provide
copy/paste functionality. Copying the image to the clipboard was easy. But
pasting an image from the clipboard is proving to be more difficult. These
pictureboxes are bound to an AccessDB. If the user wants to add an image,
they select an image using an OpenFileDialog:
Dim result As DialogResult = Pic_Sel.ShowDialog()
If (result = DialogResult.OK) Then
|
by: James Russo |
last post by:
Hello,
I have an application which requires an image to be retrived from the
clipboard. So, I am writting a quick C# windows application to take
images from a webcam and store a single frame on the clipboard so it can
be pasted into this other application. My solution is working fine with
all applications (mspaint, word, wordpad) except the one I need it to
work with. I've contacted the vendor of the application, but I haven't
been able...
|
by: Newbie |
last post by:
How do I clear the clipboard in VB.NET 2003?
TIA
Newbie
| |
by: Peter Duniho |
last post by:
I'm trying to use .NET and C# to draw a metafile copied to the clipboard by
another application (Word 2003 in this case, but it shouldn't matter).
I naively thought that I'd be able to use the Clipboard class to get an
EnhancedMetafile or MetafilePict object from the Clipboard, use that to
create a new Metafile object, and then draw that Metafile object using
Graphics.DrawImage.
It doesn't seem to be that simple.
|
by: Figmo |
last post by:
Wow.....this is darned odd....
I have an app that integrates with other applications.
It registers a global hotkey with Windows. When the hotkey executes
it sends a CTRL-C to the active window (any application) to copy
whatever text is selected to the clipboard. It then issues a C#
Clipboard.GetText(...) and does some processing with this string.
All is good, no errors thus far.
|
by: active |
last post by:
Guess I'm looking for someone who likes to work difficult puzzles.
I can't seem to ever retrieve a palette handle from the clipboard.
Below is a simple test program that demonstrates the problem.
The program uses windows api to get a handle to a palette from the
clipboard.
The palette needs to be put there by another program - maybe Photoshop.
|
by: Joe Duchtel |
last post by:
Hello -
I have the following code to get a bitmap from the clipboard and to
save it to a *.png file ...
Dim lData As IDataObject = Clipboard.GetDataObject()
If lData.GetDataPresent(DataFormats.Bitmap) Then
Dim lPictureBox As New PictureBox
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |