问题描述
- VB与西门子s7-300通讯,提示w95_s7.dll未找到
-
我想使用VB与西门子s7-300通讯,使用了w95_s7.dll动态链接库。其代码如下:
在公共模块里: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 LongType 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文件未找到,请问列为大神,到底哪里出了问题?
解决方案
把dll放到exe、目录I下