|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Extracting icon from file: most efficient method?Hi
I'm using vb.Net in VS2005 and want to extract the icon for file refence records. I saw an example a while back that searched the registry for the default icon etc. It was a little long winded. I have since discovered "Drawing.Icon.ExtractAssociatedIcon" which can do the same job in one line of code. My question then is... which is quicker, is "ExtractAssociatedIcon" simply the old method wrapped up? Thanks in advance Mark Hello again
Following on from below, is it possible to save the icon in the image list at runtime so I wouldn't have to extract it again next time? Thanks again Mark Show quoteHide quote "Mark" <m*@abc.com> wrote in message news:OvLUg.25$aZ3.21@newsfe2-win.ntli.net... > Hi > > I'm using vb.Net in VS2005 and want to extract the icon for file refence > records. > > I saw an example a while back that searched the registry for the default > icon etc. It was a little long winded. > > I have since discovered "Drawing.Icon.ExtractAssociatedIcon" which can do > the same job in one line of code. > > My question then is... which is quicker, is "ExtractAssociatedIcon" simply > the old method wrapped up? > > Thanks in advance > > Mark > > My question then is... which is quicker, is "ExtractAssociatedIcon" simply A common way to measure speed is to grab the start time, run a loop> the old method wrapped up? with the method few times, grab the endtime, and compare the two times. i.e. <pseudocode> dim starttime as double = now.milliseconds for i as integer = 1 to 1000 ' do one of the methods here next i dim endtime as double = now.milliseconds msgbox (endtime - starttime & " milliseconds") </pseudocode> Do this for both methods and see for yourself which runs faster. You may want to build a release version of the app to get to see which is faster in a "live" enviroment. Personnally, if there isn't much difference I would go for the less verbose method, so if you look back at the code in a few months you won't have much trouble figuring out whats going on. Thanks, Seth Rowe Mark wrote: Show quoteHide quote > Hi > > I'm using vb.Net in VS2005 and want to extract the icon for file refence > records. > > I saw an example a while back that searched the registry for the default > icon etc. It was a little long winded. > > I have since discovered "Drawing.Icon.ExtractAssociatedIcon" which can do > the same job in one line of code. > > My question then is... which is quicker, is "ExtractAssociatedIcon" simply > the old method wrapped up? > > Thanks in advance > > Mark Thanks Seth...
Mark Show quoteHide quote "rowe_newsgroups" <rowe_em***@yahoo.com> wrote in message news:1159978882.060878.28140@c28g2000cwb.googlegroups.com... >> My question then is... which is quicker, is "ExtractAssociatedIcon" >> simply >> the old method wrapped up? > > A common way to measure speed is to grab the start time, run a loop > with the method few times, grab the endtime, and compare the two times. > > > i.e. > > <pseudocode> > > dim starttime as double = now.milliseconds > > for i as integer = 1 to 1000 > ' do one of the methods here > next i > > dim endtime as double = now.milliseconds > > msgbox (endtime - starttime & " milliseconds") > > </pseudocode> > > Do this for both methods and see for yourself which runs faster. You > may want to build a release version of the app to get to see which is > faster in a "live" enviroment. Personnally, if there isn't much > difference I would go for the less verbose method, so if you look back > at the code in a few months you won't have much trouble figuring out > whats going on. > > Thanks, > > Seth Rowe > > > Mark wrote: >> Hi >> >> I'm using vb.Net in VS2005 and want to extract the icon for file refence >> records. >> >> I saw an example a while back that searched the registry for the default >> icon etc. It was a little long winded. >> >> I have since discovered "Drawing.Icon.ExtractAssociatedIcon" which can do >> the same job in one line of code. >> >> My question then is... which is quicker, is "ExtractAssociatedIcon" >> simply >> the old method wrapped up? >> >> Thanks in advance >> >> Mark >
You're good if you can answer this one.....
.NET 2 recommended books? Sending email with attachments Open folders to process files automatically Datetimepicker - just getting the data part ComboBox.Items.Clear() Changing Printer's default paper How to convert code snipped from VB6 to Visual Studio 2005/VB (VB7?) test "file exists" on remote computer? Does a menu item lose dataset information? |
|||||||||||||||||||||||