Can't get Bitmap from clipboard in 98 but can in XP

aewarnick

Well-known member
Joined
Jan 29, 2003
Messages
1,031
I didnt expect to post about this. I didnt know xp and 98 were sooooo different. This should do the trick:
C#:
if(Clipboard.GetDataObject().GetDataPresent(typeof(Bitmap)))
{
	Bitmap B= (Bitmap)Clipboard.GetDataObject().GetData(typeof(Bitmap));
}
Clipboard.GetDataObject().GetFormats(); returns an array that has Bitmap in there many times meaning that it can be converted to a Bitmap or Image.

I even used a try catch to force the Bitmap creation but it was caught.

How do I get Bitmaps from the clipboard in win98?
 
I am not surprised noone figured this out. It does not make sense.
What I ended up having to do is storing the clipboard IDataObject into an object variable first.

object o= Clipboard.GetDataObject().GetData(a.Checks.ClipBType());

So, if anyone else has this problem, you know what to do.
 
Back
Top