Tartten erääseen ohjelmaan ladata exen (ei .net) sisältä ico tiedostoja
Apilla pitäisi saada
Declare Function ExtractIconEx Lib "shell32.dll" Alias "ExtractIconExA" _
(ByVal lpszFile As String, _
ByVal nIconIndex As Integer, _
ByRef phiconLarge As Integer, _
ByRef phiconSmall As Integer, _
ByVal nIcons As Long) As Integer
Declare Function DestroyIcon Lib "user32.dll" (ByVal hIcon As Integer) As Integer
Declare Function GetStockObject Lib "gdi32.dll" (ByVal nIndex As Integer) As Integer
Declare Function DrawIconEx Lib "user32.dll" (ByVal hdc As Integer, ByVal xLeft As Integer, ByVal yTop As Integer, ByVal hIcon As Integer, ByVal cxWidth As Integer, ByVal cyWidth As Integer, ByVal istepIfAniCur As Integer, ByVal hbrFlickerFreeDraw As Integer, ByVal diFlags As Integer) As Integer
Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Integer, ByVal lpszExeFileName As String, ByVal nIconIndex As Integer) As Integeryritän saada määrän
Return ExtractIconEx(tiedosto, -1, 0, 0, 0)
mutta tuottaa virheen
PInvokeStackImbalance was detected
Message: A call to PInvoke function 'Testi!testi.icolue::ExtractIconEx' 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.
Vb.net:ssä Integer on 32 bittiä kun taas vanhassa VB6:ssa 16 bittiä.
Kokeile Short tyyppiä (16 bit) Integer:n paikalle.
Aihe on jo aika vanha, joten et voi enää vastata siihen.