elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Sigue las noticias más importantes de seguridad informática en el Twitter! de elhacker.NET


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP) (Moderador: kub0x)
| | | |-+  Extraer Iconos
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Extraer Iconos  (Leído 3,580 veces)
David Vans

Desconectado Desconectado

Mensajes: 193


Ver Perfil
Extraer Iconos
« en: 30 Abril 2007, 17:15 pm »

Hola amigos tengo un prblema con vb net extraigo los icons de los ficheros
Código:
    Public Shared Function GetIcon(ByVal path As String, ByVal tipo As TipoIcon) As System.Drawing.Icon
        Dim hImgSmall As IntPtr  'The handle to the system image list.
        Dim myIcon As System.Drawing.Icon
        Dim hImgLarge As IntPtr  'The handle to the system image list.
        Dim fName As String      'The file name to get the icon from.
        Dim shinfo As SHFILEINFO
        shinfo = New SHFILEINFO()
        shinfo.szDisplayName = New String(Chr(0), 260)
        shinfo.szTypeName = New String(Chr(0), 80)
        fName = path
        'Use this to get the small icon.
        Select Case tipo
            Case TipoIcon.Small
                hImgSmall = SHGetFileInfo(fName, 0, shinfo, Marshal.SizeOf(shinfo), _
                SHGFI_ICON Or SHGFI_SMALLICON)
            Case TipoIcon.Large
                hImgLarge = SHGetFileInfo(fName, 0, shinfo, Marshal.SizeOf(shinfo), SHGFI_ICON Or SHGFI_LARGEICON)
        End Select
        ' Try
        myIcon = System.Drawing.Icon.FromHandle(shinfo.hIcon)
        ' Catch ex As Exception
        ' 'Erorr
        'End Try
        Return myIcon
    End Function

La funcion funcina correctamente

Luego ago esto
Código:
Dim ImageL As New ImageList
        Dim dirsF() As FileInfo = New DirectoryInfo("C:\").GetFiles
        ListI.LargeImageList = ImageL
        For Each Dir As FileInfo In dirsF
            Dim Nod As New ListViewItem
            Nod.Text = Dir.Name
            ImageL.Images.Add(InformacíonSecurity.GetIcon(Dir.FullName, InformacíonSecurity.TipoIcon.Small))
            Nod.ImageIndex = ImageL.Images.Count - 1
            ListI.Items.Add(Nod)
        Next

Eso tambine funciona pero los iconos me parecen muy pequeños y si cambio el tamaño del imagelist se ve el icono con muy mala calidad y quero verlos grandes corectamente como pasa con explorer .

Gracias por vuestro tiempo


En línea

bitarray

Desconectado Desconectado

Mensajes: 9


Pienso luego existo


Ver Perfil WWW
Re: Extraer Iconos
« Respuesta #1 en: 22 Febrero 2009, 23:36 pm »

Mirate:

http://www.bitarray.info/2008/12/vb-c-net-obtener-el-icono-asociado-de-un-fichero/

a ver si te vale de algo...


En línea

Blog de programación: http://www.bitarray.info
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines