Extracting icon from file: most efficient method?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark

    #1

    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.E xtractAssociate dIcon" which can do
    the same job in one line of code.

    My question then is... which is quicker, is "ExtractAssocia tedIcon" simply
    the old method wrapped up?

    Thanks in advance

    Mark


  • Mark

    #2
    Re: Extracting icon from file: most efficient method? and my next question....

    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

    "Mark" <me@abc.comwrot e in message
    news:OvLUg.25$a Z3.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.E xtractAssociate dIcon" which can do
    the same job in one line of code.
    >
    My question then is... which is quicker, is "ExtractAssocia tedIcon" simply
    the old method wrapped up?
    >
    Thanks in advance
    >
    Mark
    >

    Comment

    • rowe_newsgroups

      #3
      Re: Extracting icon from file: most efficient method?

      My question then is... which is quicker, is "ExtractAssocia tedIcon" 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.millisecond s

      for i as integer = 1 to 1000
      ' do one of the methods here
      next i

      dim endtime as double = now.millisecond s

      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.E xtractAssociate dIcon" which can do
      the same job in one line of code.
      >
      My question then is... which is quicker, is "ExtractAssocia tedIcon" simply
      the old method wrapped up?
      >
      Thanks in advance
      >
      Mark

      Comment

      • Mark

        #4
        Re: Extracting icon from file: most efficient method?

        Thanks Seth...

        Mark

        "rowe_newsgroup s" <rowe_email@yah oo.comwrote in message
        news:1159978882 .060878.28140@c 28g2000cwb.goog legroups.com...
        >My question then is... which is quicker, is "ExtractAssocia tedIcon"
        >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.millisecond s
        >
        for i as integer = 1 to 1000
        ' do one of the methods here
        next i
        >
        dim endtime as double = now.millisecond s
        >
        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.E xtractAssociate dIcon" which can do
        >the same job in one line of code.
        >>
        >My question then is... which is quicker, is "ExtractAssocia tedIcon"
        >simply
        >the old method wrapped up?
        >>
        >Thanks in advance
        >>
        >Mark
        >

        Comment

        Working...