A Generic Error occurred in GDI+ when calling Bitmap.GetHicon

Viewed 3814

Why I'm getting "A Generic Error occurred in GDI+" Exception ?

IntPtr hicon = tempBitmap.GetHicon();             
Icon bitmapIcon = Icon.FromHandle(hicon);            
return bitmapIcon;

The error occurred when my application has been running for more than 30 minutes. (I am converting System.Drawing.Bitmap to System.Drawing.Icon every second)

enter image description here

2 Answers
Related