Oppure

Loading
12/06/08 10:23
alceus
Ciao a tutti,
qualcuno sa dirmi se è possibile impostare come icona di un form un file .ico della libreria C:\WINDOWS\system32\shell32.dll? Io ci ho provato, ma sono riuscito massimo ad inserirla come immagine di una picture:

Option Explicit
      Private Const MAX_PATH = 260

      Private Declare Function GetSystemDirectory Lib "kernel32" Alias _
      "GetSystemDirectoryA" (ByVal lpBuffer As String, _
                             ByVal nSize As Long) As Long

      Private Declare Function ExtractIcon Lib "shell32.dll" Alias _
      "ExtractIconA" (ByVal hInst As Long, _
                      ByVal lpszExeFileName As String, _
                      ByVal nIconIndex As Long) As Long

      Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, _
      ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long

      Dim path$, nIcon As Long

      Private Sub Command1_Click()
          Dim hIcon As Long

          hIcon = ExtractIcon(App.hInstance, path$, nIcon)
          Set Picture1.Picture = LoadPicture("") 
          Picture1.AutoRedraw = True
          Call DrawIcon(Picture1.hdc, 0, 0, hIcon)
          Picture1.AutoRedraw = False
          Picture1.Refresh
          nIcon = nIcon + 1
      End Sub

      Private Sub Form_Load()
          path$ = Space$(MAX_PATH)
          Call GetSystemDirectory(path$, MAX_PATH)
          path$ = Trim$(path$)
          path$ = Left$(path$, Len(path$) - 1) & "\Shell32.dll"
          nIcon = 0
      End Sub
          nIcon = 0
      End Sub



Help me, please 8-|
Ultima modifica effettuata da alceus 12/06/08 10:26
aaa
13/06/08 13:02
alceus
problema risolto scaricando icon sushi
aaa