N
nagar
I have a .NET 2.0 application that needs to backup and restore the
contents of the clipboard.
When I back it up, I use this code:
DataObject oldClipboard = Clipboard.GetDataObject();
IDataObject prevClipboard = new DataObject();
string[] formats;
formats = oldClipboard.GetFormats(); //gets all the possible formats
for that data
foreach (string s in formats) {
object clipdata = oldClipboard.GetData(s);
prevClipboard.SetData(s, clipdata ); //re-associate the old
data with the proper types
}
I got the error on the oldClipboard.GetData(s) line when the data in
the clipboard is of type "EnahancedMetafile" (I could reproduce it
copying a piece of text which contained an HTML email from OneNote).
The error message says: Error address 0x79f387cc. Error code
0xc0000005
I saw there's no way I can trap this error in the code. At the moment,
I'm just ignoring the "EnhancedMetafile" format.
Thanks.
Andrea
contents of the clipboard.
When I back it up, I use this code:
DataObject oldClipboard = Clipboard.GetDataObject();
IDataObject prevClipboard = new DataObject();
string[] formats;
formats = oldClipboard.GetFormats(); //gets all the possible formats
for that data
foreach (string s in formats) {
object clipdata = oldClipboard.GetData(s);
prevClipboard.SetData(s, clipdata ); //re-associate the old
data with the proper types
}
I got the error on the oldClipboard.GetData(s) line when the data in
the clipboard is of type "EnahancedMetafile" (I could reproduce it
copying a piece of text which contained an HTML email from OneNote).
The error message says: Error address 0x79f387cc. Error code
0xc0000005
I saw there's no way I can trap this error in the code. At the moment,
I'm just ignoring the "EnhancedMetafile" format.
Thanks.
Andrea