Extraire un ressource .ico VB.net

Bonjour a tous,
Pouvez vous M' expliquer comment extraire un fichier icone de depuis les ressource de mon
programme créer avec Visual Basic studio 2010

Merci

2 réponses

  • Votes
  • Date
  • Date décroissante
  1. Contributeur
    Bonjour,
    Si ton icône est déjà dans le fichier ressources.
        Me.Icon = My.Ressoures.LeNomDeIcone

    Pas d'extension.
    A+
    1. J'ai rédigé un article en anglais pour commencer: "How to extract icon from file"
      http://checktechno.blogspot.com/2013/04/how-to-extract-icon-from-file.html

      l'essentiel du code , le voici:

      à mettre dans la classe:

      <System.Runtime.InteropServices.DllImport("shell32.dll")> Shared Function _
          ExtractAssociatedIcon(ByVal hinst As IntPtr, ByVal lpiconpath As String, _
                                 ByRef lpiicon As Integer) As IntPtr
          End Function
      


      et dans ta fonction tu mets:

       
      For index1 = 0 To 300 Step 1
                      hIcon = ExtractAssociatedIcon(Me.Handle, sPath, index1)
                      oIcon = Icon.FromHandle(hIcon)
                      ImageList1.Images.Add(oIcon)
                      ImageList2.Images.Add(oIcon)
                      ListView1.Items.Add(index1.ToString, index1)
      Next index1