saving icon to hard drive
-
Hello all.. How to get the icon that is associate with the file? I have email item... which contain file attachments.. So first get the file attachment using mail.Attachments and mail.Attachment. Up to here no problem.. here the code to get the icon and saving it in C:\PCKM so I can call the image file from HTML code
Function GetIconLocation(ByVal filename As String) As String Dim loc As String 'Use this to get the small icon. Dim fName As String 'The file name to get the icon from. Dim shinfo As SHFILEINFO shinfo = New SHFILEINFO Dim openFileDialog1 As OpenFileDialog openFileDialog1 = New OpenFileDialog Dim hImgSmall As IntPtr 'The handle to the system image list. hImgSmall = SHGetFileInfo(filename, 0, shinfo, Marshal.SizeOf(shinfo), SHGFI_ICON Or SHGFI_SMALLICON) Dim hIcon As Icon hIcon = Icon.FromHandle(shinfo.hIcon) Dim bip As System.Drawing.Bitmap bip = hIcon.ToBitmap() bip.Save("c:\pckm\icon.bmp") loc = " " & filename GetIconLocation = loc End Function
After I saved the icon.bmp I try to open it by double clicking the file or using open with to oen the file but can't open with any other programs How to save the icon to the hard drive??? Thank you