Option Explicit
Public Declare Function load_tool Lib "w95_s7.dll" (ByVal nr As Byte, ByVal dev As String, adr As PlcAdrType) As Long
Public Declare Function db_read Lib "w95_s7.dll" (ByVal blockno As Long, ByVal no As Long, Amount As Long, value As Byte) As Long
Public Declare Function db_write Lib "w95_s7.dll" (ByVal blockno As Long, ByVal no As Long, Amount As Long, value As Byte) As Long
Type PlcAdrType
ADDRESS As Byte
SEGMENTID As Byte
SLOTNO As Byte
PACKNO As Byte
End Type
在窗口页面,我建了按钮,按钮下代码如下:
Dim i As Long
Dim a11 As PlcAdrType
a11.ADDRESS = 2
a11.SEGMENTID = 0
a11.SLOTNO = 2
a11.PACKNO = 0
i = load_tool(1, "S7ONLINE", a11)
If (i <> 0) Then
MsgBox ("连接成功")
Else
MsgBox ("连接失败")
End If
运行程序后,点击按钮就会提示我,w95_s7.dll文件未找到,请问列为大神,到底哪里出了问题?