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.GetDa taObject();
IDataObject prevClipboard = new DataObject();
string[] formats;
formats = oldClipboard.Ge tFormats(); //gets all the possible formats
for that data
foreach (string s in formats) {
object clipdata = oldClipboard.Ge tData(s);
prevClipboard.S etData(s, clipdata ); //re-associate the old
data with the proper types
}
I got the error on the oldClipboard.Ge tData(s) line when the data in
the clipboard is of type "EnahancedMetaf ile" (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 "EnhancedMetafi le" format.
Thanks.
Andrea