0
我有一個代碼在VB編碼在Microsoft Visual Studio 2015不幸的是我運行程序時出現錯誤。Pinvoke堆棧不平衡發生,檢查Internet連接
這裏的錯誤:
Managed Debugging Assistant 'PInvokeStackImbalance' has detected a problem in 'C:\Users\PC_6\Documents\Visual Studio 2015\Projects\Test\test\bin\Debug\Test.vshost.exe'.
Additional information: A call to PInvoke function 'Test!Test.Form1::InternetGetConnectedState' has unbalanced the stack.
這裏是我的代碼。
Imports System.Runtime.InteropServices
Public Class Form1
Private Declare Function InternetGetConnectedState Lib "wininet" (ByRef conn As Long, ByVal val As Long) As Boolean
Private Sub btnPay_Click(sender As Object, e As EventArgs) Handles btnPay.Click
Select Case ListBox1.SelectedIndex
Case 0
MsgBox("Selected Payment is " + ListBox1.SelectedItem)
Case 1
MsgBox("Selected Payment is " + ListBox1.SelectedItem)
Case 2
btnPay.Text = ("Checking Connection")
Dim Out As Integer
If InternetGetConnectedState(Out, 0) = True Then
MsgBox("Connected!")
Else
MsgBox("No Connection!")
End If
Case Else
MsgBox("Please Select a Payment Type")
End Select
End Sub
末級
http://pinvoke.net/default.aspx/wininet/InternetGetConnectedState.html –
'...因爲長'是錯的 – Plutonix