Extracting icon from file: most efficient method?

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

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
 
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
 
Thanks Seth...

Mark

rowe_newsgroups said:
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
 
Back
Top