Extracting icon from file: most efficient method?

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
 
M

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
 
R

rowe_newsgroups

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
 
M

Mark

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top