[DllImport("user32.dll", SetLastError=true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool DestroyIcon(IntPtr hIcon);
Public Declare Function DestroyIcon Lib "user32" (ByVal hIcon As IntPtr) As Integer
<DllImport("user32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _
Shared Function DestroyIcon (ByVal hIcon As IntPtr) As Integer
End Function
None.
As always, only do SetLastError=true if you actually intend to call GetLastError.
Please add some!
Bitmap bmp = (Bitmap)Image.FromFile(fileName);
IntPtr hicon = bmp.GetHicon();
Icon icon = Icon.FromHandle(hicon);
DestroyIcon(hicon);
Omnicoder's Managed Windows API: http://www.fileden.com/files/2008/4/5/1852663/ManWinAPI.zip (broken)