Bonsoir à tous,
JE tente de récupérer la première icone du fichier avec le code ci-dessous...
quand j'exécute vb me retourne ce pb :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long Function test() Dim mCompositeImage As Image Dim hIcon As Long = ExtractIcon(0, "C:\WINDOWS\SYSTEM\SHELL32.DLL", 0) 'ShowIcon("C:\WINDOWS\SYSTEM\SHELL32.DLL", 0, PictureBox1, 0, 0) Try Dim mIcon As System.Drawing.Icon = System.Drawing.Icon.FromHandle(hIcon) mCompositeImage = mIcon.ToBitmap Catch ex As Exception ' create a blank black bitmap to return mCompositeImage = New Bitmap(16, 16) End Try ' return the composited image Return mCompositeImage End Function Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click test() End Sub
je n'ai quasi plus de cheveux à cose de ce problème ^^A call to PInvoke function 'test!test.Form1::ExtractIcon' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
pourriez vous m'aider ?
Merci d'avance.
Partager