Hi:
I'm trying to call "InternetOpenA" function which is in "wininet.dll"
This is my code
An I get the next error when I call InternetOpen function
A call to PInvoke function 'appApi!appApi.Form1::InternetOpen' 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.
The code works on vb 6.0 but it does not in vb.net
I also tried declare InternetOpen function in this way
but I get the same error
what would be wrong?
I'm programming in vb.net 2005
net framework 3.0
windows xp sp2
Thanks!
I'm trying to call "InternetOpenA" function which is in "wininet.dll"
This is my code
Code:
'Declaration of API
Declare Auto Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" _
(ByVal sAgent As String, ByVal lAccessType As Long, _
ByVal sProxyName As String, _
ByVal sProxyBypass As String, _
ByVal lFlags As Long) As Long
'the code which calls the function
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Const INTERNET_OPEN_TYPE_PRECONFIG = 0
Dim hOpen As Long
hOpen = InternetOpen(vbNullString, _
INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, _
vbNullString, 0)
End Sub
A call to PInvoke function 'appApi!appApi.Form1::InternetOpen' 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.
The code works on vb 6.0 but it does not in vb.net
I also tried declare InternetOpen function in this way
Code:
<DllImport("wininet.dll")> _
Public Shared Function InternetOpen(ByVal sAgent As String, _
ByVal lAccessType As Long, _
ByVal sProxyName As String, _
ByVal sProxyBypass As String, _
ByVal lFlags As Integer) As Integer
End Function
what would be wrong?
I'm programming in vb.net 2005
net framework 3.0
windows xp sp2
Thanks!