我的vb.net代码有问题...
我创建了一个C ++ .dll文件,当禁用WiFi时该文件返回0。这段代码可以完美地运行20个循环,然后给我一个错误的读数。几乎好像它每次都不会卸载dll文件,并且在20个进程生成后会阻止它。
Imports System.Media
Imports System.Runtime.InteropServices
Module Module1
<DllImport("C:\Dll2.dll",CharSet:=CharSet.Unicode,CallingConvention:=CallingConvention.Cdecl)>
Friend Function Helloworld(
ByVal i As Int32) As Int32
End Function
Sub Main()
While (1 = 1)
Dim A
A = Helloworld(5)
Console.WriteLine(A)
If A = 0 Then
WiFi_Disabled()
End If
Threading.Thread.Sleep(1000)
End While
End Sub
Public Function WiFi_Disabled()
Dim speech
speech = CreateObject("sapi.spvoice")
speech.speak("Please Turn your Wifi Back on")
End Function
End Module
感谢您的帮助:)