שתף באמצעות


extract icon from internet shortcut

Question

Tuesday, April 2, 2013 4:02 PM

how I can extract icon from a file internet shortcut in vb.net .

All replies (5)

Wednesday, April 3, 2013 8:44 AM ✅Answered | 1 vote

If you have a .lnk file on disk, you can extract the icon using

*    Dim icon = System.Drawing.Icon.ExtractAssociatedIcon(“MyFile.lnk”).*

Then you can obtain the image using icon.ToBitmap.


Tuesday, April 2, 2013 6:43 PM

If the file is an internet file and if it's protected as internet files are supposed to be...there is no way to copy it programmatically.

Renee

"MODERN PROGRAMMING is deficient in elementary ways BECAUSE of problems INTRODUCED by MODERN PROGRAMMING." Me


Wednesday, April 3, 2013 6:10 AM

If you mean the shortcut icon that is also displayed by browsers in address bar or tabs, then you can download it using a fragment like this:

My.Computer.Network.DownloadFile("http://bing.com/favicon.ico", "D:\MyFile.ico")

This example saves the icon (always called “favicon.ico”) used by Bing web site.

What do you mean by “file internet shortcut”?


Wednesday, April 3, 2013 7:26 AM

If you mean the shortcut icon that is also displayed by browsers in address bar or tabs, then you can download it using a fragment like this:

My.Computer.Network.DownloadFile("http://bing.com/favicon.ico", "D:\MyFile.ico")

This example saves the icon (always called “favicon.ico”) used by Bing web site.

What do you mean by “file internet shortcut”?

i make a webbrowser program by vb.net then can view favorite like internet explorer but i have a problem by get icon from .Ink and show as image


Wednesday, April 3, 2013 8:28 PM

If you have a .lnk file on disk, you can extract the icon using

*    Dim icon = System.Drawing.Icon.ExtractAssociatedIcon(“MyFile.lnk”).*

Then you can obtain the image using icon.ToBitmap.

thank you very much.