Extract Icon

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?QmVu?=

    Extract Icon

    Hi
    I am looking for a way to extraxt an icon from a .exe file an save it as an
    icon not a bitmap or jpeg to a file?

    The code below extracts the icon but only as a bitmap

    PictureBox1.Ima ge =
    Drawing.Icon.Ex tractAssociated Icon("file.exe" ).ToBitmap

    The problem is I need the icon not the bitmap.
    Thanks
  • Gillard

    #2
    Re: Extract Icon


    Dim x As Integer = 1
    'img is an imagelist
    For Each ico As Image In img.Images
    x = x + 1
    pb1.Image = ico
    Application.DoE vents()
    ico.Save(apath & "icones\" & IO.Path.GetFile Name(fil) & x &
    ".ico", System.Drawing. Imaging.ImageFo rmat.Icon)
    Next

    "Ben" <Ben@discussion s.microsoft.com wrote in message
    news:6BCDE5BD-44D5-4D3A-844A-ECEFC17B8621@mi crosoft.com...
    Hi
    I am looking for a way to extraxt an icon from a .exe file an save it as
    an
    icon not a bitmap or jpeg to a file?
    >
    The code below extracts the icon but only as a bitmap
    >
    PictureBox1.Ima ge =
    Drawing.Icon.Ex tractAssociated Icon("file.exe" ).ToBitmap
    >
    The problem is I need the icon not the bitmap.
    Thanks

    Comment

    • =?Utf-8?B?QmVu?=

      #3
      Re: Extract Icon

      Hi Gillard

      I know your code can work. but for some reason it is not working for me.
      I added an imagelist
      But what is "apath"
      What is "fil"

      When I ran your code, i used "c:\mydir" for "apath" and the path for
      winword for "fil", I get a new page icon instead of the winword icon in the
      folder.

      Also for me to get anything at all I first had to run code to put the icon
      into the imagelist and the picturebox
      Here is the code I used to put the icon into the image list:

      Private Sub Button4_Click(B yVal sender As System.Object, ByVal e As
      System.EventArg s) Handles Button4.Click
      Dim ico As Icon = Icon.ExtractAss ociatedIcon(the path for
      "winword.ex e")
      ImageList1.Imag eSize = New Size(24, 24)
      ImageList1.Imag es.Add(ico)

      Dim theGraphics As Graphics = Graphics.FromHw nd(Me.Handle)

      For count = 0 To ImageList1.Imag es.Count - 1

      ImageList1.Draw (theGraphics, New Point(24, 24), count)

      ' Call Application.DoE vents to force a repaint of the form.
      Application.DoE vents()

      ' Call the Sleep method to allow the user to see the image.
      System.Threadin g.Thread.Sleep( 1000)
      Next

      I am sorry, but I think I need a some more help on this...please

      "Gillard" wrote:
      >
      Dim x As Integer = 1
      'img is an imagelist
      For Each ico As Image In img.Images
      x = x + 1
      pb1.Image = ico
      Application.DoE vents()
      ico.Save(apath & "icones\" & IO.Path.GetFile Name(fil) & x &
      ".ico", System.Drawing. Imaging.ImageFo rmat.Icon)
      Next
      >
      "Ben" <Ben@discussion s.microsoft.com wrote in message
      news:6BCDE5BD-44D5-4D3A-844A-ECEFC17B8621@mi crosoft.com...
      Hi
      I am looking for a way to extraxt an icon from a .exe file an save it as
      an
      icon not a bitmap or jpeg to a file?

      The code below extracts the icon but only as a bitmap

      PictureBox1.Ima ge =
      Drawing.Icon.Ex tractAssociated Icon("file.exe" ).ToBitmap

      The problem is I need the icon not the bitmap.
      Thanks
      >
      >

      Comment

      • =?Utf-8?B?QmVu?=

        #4
        Re: Extract Icon

        Hi Gillard
        The "Icon Ripper.Zip" attachment did not come thru. Can you resend it?

        "Gillard" wrote:
        >
        here is the full version of the program as attachment " icon ripper.zip "
        >
        apath is a directory (drive \ directory)
        >
        fil is a filepath ( drive \ directory \ filename)
        >
        "Ben" <Ben@discussion s.microsoft.com wrote in message
        news:2BE9CF20-18B2-4F43-93ED-E8B452D43D20@mi crosoft.com...
        Hi Gillard

        I know your code can work. but for some reason it is not working for me.
        I added an imagelist
        But what is "apath"
        What is "fil"

        When I ran your code, i used "c:\mydir" for "apath" and the path for
        winword for "fil", I get a new page icon instead of the winword icon in
        the
        folder.

        Also for me to get anything at all I first had to run code to put the icon
        into the imagelist and the picturebox
        Here is the code I used to put the icon into the image list:

        Private Sub Button4_Click(B yVal sender As System.Object, ByVal e As
        System.EventArg s) Handles Button4.Click
        Dim ico As Icon = Icon.ExtractAss ociatedIcon(the path for
        "winword.ex e")
        ImageList1.Imag eSize = New Size(24, 24)
        ImageList1.Imag es.Add(ico)

        Dim theGraphics As Graphics = Graphics.FromHw nd(Me.Handle)

        For count = 0 To ImageList1.Imag es.Count - 1

        ImageList1.Draw (theGraphics, New Point(24, 24), count)

        ' Call Application.DoE vents to force a repaint of the form.
        Application.DoE vents()

        ' Call the Sleep method to allow the user to see the image.
        System.Threadin g.Thread.Sleep( 1000)
        Next

        I am sorry, but I think I need a some more help on this...please

        "Gillard" wrote:
        >
        Dim x As Integer = 1
        'img is an imagelist
        For Each ico As Image In img.Images
        x = x + 1
        pb1.Image = ico
        Application.DoE vents()
        ico.Save(apath & "icones\" & IO.Path.GetFile Name(fil) & x &
        ".ico", System.Drawing. Imaging.ImageFo rmat.Icon)
        Next
        >
        "Ben" <Ben@discussion s.microsoft.com wrote in message
        news:6BCDE5BD-44D5-4D3A-844A-ECEFC17B8621@mi crosoft.com...
        Hi
        I am looking for a way to extraxt an icon from a .exe file an save it
        as
        an
        icon not a bitmap or jpeg to a file?

        The code below extracts the icon but only as a bitmap

        PictureBox1.Ima ge =
        Drawing.Icon.Ex tractAssociated Icon("file.exe" ).ToBitmap

        The problem is I need the icon not the bitmap.
        Thanks
        >
        >

        Comment

        • =?Utf-8?B?QmVu?=

          #5
          Re: Extract Icon

          Hi there
          Sorry to say, but for some reason I still have not seen the attachment, and
          it is something I really need to take a look at.
          I think it maybe bacause I was using IE 8.2 Beta. I am back to using IE 7.0
          now. So, I am asking that you resend the attachment one last time for me
          please.
          Thanks

          "Gillard" wrote:
          yes
          >
          "Ben" <Ben@discussion s.microsoft.com wrote in message
          news:E648D842-C7AF-44AA-B744-006EA4447D23@mi crosoft.com...
          Hi Gillard
          The "Icon Ripper.Zip" attachment did not come thru. Can you resend it?

          "Gillard" wrote:
          >
          here is the full version of the program as attachment " icon
          ripper.zip "
          >
          apath is a directory (drive \ directory)
          >
          fil is a filepath ( drive \ directory \ filename)
          >
          "Ben" <Ben@discussion s.microsoft.com wrote in message
          news:2BE9CF20-18B2-4F43-93ED-E8B452D43D20@mi crosoft.com...
          Hi Gillard

          I know your code can work. but for some reason it is not working for
          me.
          I added an imagelist
          But what is "apath"
          What is "fil"

          When I ran your code, i used "c:\mydir" for "apath" and the path for
          winword for "fil", I get a new page icon instead of the winword icon in
          the
          folder.

          Also for me to get anything at all I first had to run code to put the
          icon
          into the imagelist and the picturebox
          Here is the code I used to put the icon into the image list:

          Private Sub Button4_Click(B yVal sender As System.Object, ByVal e As
          System.EventArg s) Handles Button4.Click
          Dim ico As Icon = Icon.ExtractAss ociatedIcon(the path for
          "winword.ex e")
          ImageList1.Imag eSize = New Size(24, 24)
          ImageList1.Imag es.Add(ico)

          Dim theGraphics As Graphics = Graphics.FromHw nd(Me.Handle)

          For count = 0 To ImageList1.Imag es.Count - 1

          ImageList1.Draw (theGraphics, New Point(24, 24), count)

          ' Call Application.DoE vents to force a repaint of the form.
          Application.DoE vents()

          ' Call the Sleep method to allow the user to see the image.
          System.Threadin g.Thread.Sleep( 1000)
          Next

          I am sorry, but I think I need a some more help on this...please

          "Gillard" wrote:

          >
          Dim x As Integer = 1
          'img is an imagelist
          For Each ico As Image In img.Images
          x = x + 1
          pb1.Image = ico
          Application.DoE vents()
          ico.Save(apath & "icones\" & IO.Path.GetFile Name(fil) & x
          &
          ".ico", System.Drawing. Imaging.ImageFo rmat.Icon)
          Next
          >
          "Ben" <Ben@discussion s.microsoft.com wrote in message
          news:6BCDE5BD-44D5-4D3A-844A-ECEFC17B8621@mi crosoft.com...
          Hi
          I am looking for a way to extraxt an icon from a .exe file an save
          it
          as
          an
          icon not a bitmap or jpeg to a file?

          The code below extracts the icon but only as a bitmap

          PictureBox1.Ima ge =
          Drawing.Icon.Ex tractAssociated Icon("file.exe" ).ToBitmap

          The problem is I need the icon not the bitmap.
          Thanks
          >
          >

          Comment

          • eBob.com

            #6
            Re: Extract Icon

            I wonder if some news servers do not allow attachments for this group? I
            saw at least one of the earlier attachments. I use news.microsoft. com for
            this newsgroup. It's free - so if that's not the server you use to see this
            newsgroup I recommend that you try it.

            Bob

            "Ben" <Ben@discussion s.microsoft.com wrote in message
            news:2DFC04B0-1408-43C6-BAC3-541E9CDF3B31@mi crosoft.com...
            Hi there
            Sorry to say, but for some reason I still have not seen the attachment,
            and
            it is something I really need to take a look at.
            I think it maybe bacause I was using IE 8.2 Beta. I am back to using IE
            7.0
            now. So, I am asking that you resend the attachment one last time for me
            please.
            Thanks
            >
            "Gillard" wrote:
            >
            >yes
            >>
            >"Ben" <Ben@discussion s.microsoft.com wrote in message
            >news:E648D84 2-C7AF-44AA-B744-006EA4447D23@mi crosoft.com...
            Hi Gillard
            The "Icon Ripper.Zip" attachment did not come thru. Can you resend it?
            >
            "Gillard" wrote:
            >
            >>
            >here is the full version of the program as attachment " icon
            >ripper.zip "
            >>
            >apath is a directory (drive \ directory)
            >>
            >fil is a filepath ( drive \ directory \ filename)
            >>
            >"Ben" <Ben@discussion s.microsoft.com wrote in message
            >news:2BE9CF2 0-18B2-4F43-93ED-E8B452D43D20@mi crosoft.com...
            Hi Gillard
            >
            I know your code can work. but for some reason it is not working for
            me.
            I added an imagelist
            But what is "apath"
            What is "fil"
            >
            When I ran your code, i used "c:\mydir" for "apath" and the path
            for
            winword for "fil", I get a new page icon instead of the winword icon
            in
            the
            folder.
            >
            Also for me to get anything at all I first had to run code to put
            the
            icon
            into the imagelist and the picturebox
            Here is the code I used to put the icon into the image list:
            >
            Private Sub Button4_Click(B yVal sender As System.Object, ByVal e As
            System.EventArg s) Handles Button4.Click
            Dim ico As Icon = Icon.ExtractAss ociatedIcon(the path for
            "winword.ex e")
            ImageList1.Imag eSize = New Size(24, 24)
            ImageList1.Imag es.Add(ico)
            >
            Dim theGraphics As Graphics = Graphics.FromHw nd(Me.Handle)
            >
            For count = 0 To ImageList1.Imag es.Count - 1
            >
            ImageList1.Draw (theGraphics, New Point(24, 24), count)
            >
            ' Call Application.DoE vents to force a repaint of the
            form.
            Application.DoE vents()
            >
            ' Call the Sleep method to allow the user to see the
            image.
            System.Threadin g.Thread.Sleep( 1000)
            Next
            >
            I am sorry, but I think I need a some more help on this...please
            >
            "Gillard" wrote:
            >
            >>
            > Dim x As Integer = 1
            > 'img is an imagelist
            > For Each ico As Image In img.Images
            > x = x + 1
            > pb1.Image = ico
            > Application.DoE vents()
            > ico.Save(apath & "icones\" & IO.Path.GetFile Name(fil) &
            >x
            >&
            >".ico", System.Drawing. Imaging.ImageFo rmat.Icon)
            > Next
            >>
            >"Ben" <Ben@discussion s.microsoft.com wrote in message
            >news:6BCDE5B D-44D5-4D3A-844A-ECEFC17B8621@mi crosoft.com...
            Hi
            I am looking for a way to extraxt an icon from a .exe file an
            save
            it
            as
            an
            icon not a bitmap or jpeg to a file?
            >
            The code below extracts the icon but only as a bitmap
            >
            PictureBox1.Ima ge =
            Drawing.Icon.Ex tractAssociated Icon("file.exe" ).ToBitmap
            >
            The problem is I need the icon not the bitmap.
            Thanks
            >>
            >>

            Comment

            • Gillard

              #7
              Re: Extract Icon

              Use a news reader exemple Windows Live Mail
              protocol NNTP
              port : 119
              server: msnews.microsof t.com
              the attachment is there

              "eBob.com" <fakename@total lybogus.comwrot e in message
              news:ud1AlgdHJH A.652@TK2MSFTNG P04.phx.gbl...
              I wonder if some news servers do not allow attachments for this group? I
              saw at least one of the earlier attachments. I use news.microsoft. com for
              this newsgroup. It's free - so if that's not the server you use to see
              this newsgroup I recommend that you try it.
              >
              Bob
              >
              "Ben" <Ben@discussion s.microsoft.com wrote in message
              news:2DFC04B0-1408-43C6-BAC3-541E9CDF3B31@mi crosoft.com...
              >Hi there
              >Sorry to say, but for some reason I still have not seen the attachment,
              >and
              >it is something I really need to take a look at.
              >I think it maybe bacause I was using IE 8.2 Beta. I am back to using IE
              >7.0
              >now. So, I am asking that you resend the attachment one last time for me
              >please.
              >Thanks
              >>
              >"Gillard" wrote:
              >>
              >>yes
              >>>
              >>"Ben" <Ben@discussion s.microsoft.com wrote in message
              >>news:E648D8 42-C7AF-44AA-B744-006EA4447D23@mi crosoft.com...
              >Hi Gillard
              >The "Icon Ripper.Zip" attachment did not come thru. Can you resend it?
              >>
              >"Gillard" wrote:
              >>
              >>>
              >>here is the full version of the program as attachment " icon
              >>ripper.zip "
              >>>
              >>apath is a directory (drive \ directory)
              >>>
              >>fil is a filepath ( drive \ directory \ filename)
              >>>
              >>"Ben" <Ben@discussion s.microsoft.com wrote in message
              >>news:2BE9CF 20-18B2-4F43-93ED-E8B452D43D20@mi crosoft.com...
              >Hi Gillard
              >>
              >I know your code can work. but for some reason it is not working
              >for
              >me.
              >I added an imagelist
              >But what is "apath"
              >What is "fil"
              >>
              >When I ran your code, i used "c:\mydir" for "apath" and the path
              >for
              >winword for "fil", I get a new page icon instead of the winword
              >icon in
              >the
              >folder.
              >>
              >Also for me to get anything at all I first had to run code to put
              >the
              >icon
              >into the imagelist and the picturebox
              >Here is the code I used to put the icon into the image list:
              >>
              >Private Sub Button4_Click(B yVal sender As System.Object, ByVal e As
              >System.EventAr gs) Handles Button4.Click
              > Dim ico As Icon = Icon.ExtractAss ociatedIcon(the path for
              >"winword.exe ")
              > ImageList1.Imag eSize = New Size(24, 24)
              > ImageList1.Imag es.Add(ico)
              >>
              > Dim theGraphics As Graphics = Graphics.FromHw nd(Me.Handle)
              >>
              > For count = 0 To ImageList1.Imag es.Count - 1
              >>
              > ImageList1.Draw (theGraphics, New Point(24, 24), count)
              >>
              > ' Call Application.DoE vents to force a repaint of the
              >form.
              > Application.DoE vents()
              >>
              > ' Call the Sleep method to allow the user to see the
              >image.
              > System.Threadin g.Thread.Sleep( 1000)
              > Next
              >>
              >I am sorry, but I think I need a some more help on this...please
              >>
              >"Gillard" wrote:
              >>
              >>>
              >> Dim x As Integer = 1
              >> 'img is an imagelist
              >> For Each ico As Image In img.Images
              >> x = x + 1
              >> pb1.Image = ico
              >> Application.DoE vents()
              >> ico.Save(apath & "icones\" & IO.Path.GetFile Name(fil)
              >>& x
              >>&
              >>".ico", System.Drawing. Imaging.ImageFo rmat.Icon)
              >> Next
              >>>
              >>"Ben" <Ben@discussion s.microsoft.com wrote in message
              >>news:6BCDE5 BD-44D5-4D3A-844A-ECEFC17B8621@mi crosoft.com...
              >Hi
              >I am looking for a way to extraxt an icon from a .exe file an
              >save
              >it
              >as
              >an
              >icon not a bitmap or jpeg to a file?
              >>
              >The code below extracts the icon but only as a bitmap
              >>
              > PictureBox1.Ima ge =
              >Drawing.Icon.E xtractAssociate dIcon("file.exe ").ToBitmap
              >>
              >The problem is I need the icon not the bitmap.
              >Thanks
              >>>
              >>>
              >
              >

              Comment

              • =?Utf-8?B?QmVu?=

                #8
                Re: Extract Icon

                Thanks I got it

                "Gillard" wrote:
                Use a news reader exemple Windows Live Mail
                protocol NNTP
                port : 119
                server: msnews.microsof t.com
                the attachment is there
                >
                "eBob.com" <fakename@total lybogus.comwrot e in message
                news:ud1AlgdHJH A.652@TK2MSFTNG P04.phx.gbl...
                I wonder if some news servers do not allow attachments for this group? I
                saw at least one of the earlier attachments. I use news.microsoft. com for
                this newsgroup. It's free - so if that's not the server you use to see
                this newsgroup I recommend that you try it.

                Bob

                "Ben" <Ben@discussion s.microsoft.com wrote in message
                news:2DFC04B0-1408-43C6-BAC3-541E9CDF3B31@mi crosoft.com...
                Hi there
                Sorry to say, but for some reason I still have not seen the attachment,
                and
                it is something I really need to take a look at.
                I think it maybe bacause I was using IE 8.2 Beta. I am back to using IE
                7.0
                now. So, I am asking that you resend the attachment one last time for me
                please.
                Thanks
                >
                "Gillard" wrote:
                >
                >yes
                >>
                >"Ben" <Ben@discussion s.microsoft.com wrote in message
                >news:E648D84 2-C7AF-44AA-B744-006EA4447D23@mi crosoft.com...
                Hi Gillard
                The "Icon Ripper.Zip" attachment did not come thru. Can you resend it?
                >
                "Gillard" wrote:
                >
                >>
                >here is the full version of the program as attachment " icon
                >ripper.zip "
                >>
                >apath is a directory (drive \ directory)
                >>
                >fil is a filepath ( drive \ directory \ filename)
                >>
                >"Ben" <Ben@discussion s.microsoft.com wrote in message
                >news:2BE9CF2 0-18B2-4F43-93ED-E8B452D43D20@mi crosoft.com...
                Hi Gillard
                >
                I know your code can work. but for some reason it is not working
                for
                me.
                I added an imagelist
                But what is "apath"
                What is "fil"
                >
                When I ran your code, i used "c:\mydir" for "apath" and the path
                for
                winword for "fil", I get a new page icon instead of the winword
                icon in
                the
                folder.
                >
                Also for me to get anything at all I first had to run code to put
                the
                icon
                into the imagelist and the picturebox
                Here is the code I used to put the icon into the image list:
                >
                Private Sub Button4_Click(B yVal sender As System.Object, ByVal e As
                System.EventArg s) Handles Button4.Click
                Dim ico As Icon = Icon.ExtractAss ociatedIcon(the path for
                "winword.ex e")
                ImageList1.Imag eSize = New Size(24, 24)
                ImageList1.Imag es.Add(ico)
                >
                Dim theGraphics As Graphics = Graphics.FromHw nd(Me.Handle)
                >
                For count = 0 To ImageList1.Imag es.Count - 1
                >
                ImageList1.Draw (theGraphics, New Point(24, 24), count)
                >
                ' Call Application.DoE vents to force a repaint of the
                form.
                Application.DoE vents()
                >
                ' Call the Sleep method to allow the user to see the
                image.
                System.Threadin g.Thread.Sleep( 1000)
                Next
                >
                I am sorry, but I think I need a some more help on this...please
                >
                "Gillard" wrote:
                >
                >>
                > Dim x As Integer = 1
                > 'img is an imagelist
                > For Each ico As Image In img.Images
                > x = x + 1
                > pb1.Image = ico
                > Application.DoE vents()
                > ico.Save(apath & "icones\" & IO.Path.GetFile Name(fil)
                >& x
                >&
                >".ico", System.Drawing. Imaging.ImageFo rmat.Icon)
                > Next
                >>
                >"Ben" <Ben@discussion s.microsoft.com wrote in message
                >news:6BCDE5B D-44D5-4D3A-844A-ECEFC17B8621@mi crosoft.com...
                Hi
                I am looking for a way to extraxt an icon from a .exe file an
                save
                it
                as
                an
                icon not a bitmap or jpeg to a file?
                >
                The code below extracts the icon but only as a bitmap
                >
                PictureBox1.Ima ge =
                Drawing.Icon.Ex tractAssociated Icon("file.exe" ).ToBitmap
                >
                The problem is I need the icon not the bitmap.
                Thanks
                >>
                >>
                >

                Comment

                Working...