2 u010035762 u010035762 于 2013.09.06 15:02 提问

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 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文件未找到,请问列为大神,到底哪里出了问题?

1个回答

oyljerry
oyljerry   Ds   Rxr 2015.01.03 21:58

把dll放到exe、目录I下

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!