| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1296 人关注过本帖
标题:VFP 引用DLL 显示错误
取消只看楼主 加入收藏
aroffice
Rank: 2
等 级:论坛游民
帖 子:56
专家分:20
注 册:2011-9-23
结帖率:84.21%
收藏
已结贴  问题点数:20 回复次数:3 
VFP 引用DLL 显示错误
准备做一个验证码本地识别,在网上找了一些代码,但在VFP中引用显示错误
需要怎样修改
test.rar (486.53 KB)

图片附件: 游客没有浏览图片的权限,请 登录注册
搜索更多相关主题的帖子: 错误 引用 VFP DLL 显示 
2022-06-24 13:30
aroffice
Rank: 2
等 级:论坛游民
帖 子:56
专家分:20
注 册:2011-9-23
收藏
得分:0 
Private Declare Function loadcode Lib "ycode.dll" (ByVal code As Long, ByVal Length As Long, ByVal address As String, ByVal pass As String) As Long
Private Declare Function Recognition Lib "ycode.dll" (ByVal ItemNo As Long, ByVal picin As Long, ByVal Length As Long, ByVal Address1 As String, ByVal Address2 As String, lppicout As Long, lpLength As Long, cLength As Long) As Long
Private Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" (ByVal lpString1 As String, ByVal lpString2 As Long) As Long
Private Declare Function Writepic Lib "ycode.dll" (ByVal c As String) As Long
Dim strResult As String '识别结果
Dim no1 As Long
Dim no2 As Long
Dim n1 As Long '图片指针
Dim n2 As Long '指针长度

Private Sub Form_Load()
no1 = loadcode(0, 0, "myfc.fc", "") '载入验证码库,把路径换成你的库,当然你也可以直接传递数据,返回项目个数,最后一个参数为库文件密码,如果库文件有密码,这里必须加上
End Sub

Private Sub Command1_Click()

strResult = "    " '验证码都是4个字符的先初始一个4个字节的空白字符串,对于字母长度不定的可以通过Recognition的第8个参数获取字母长度

no1 = Recognition(1, 0, 0, "http://passport., "", n1, n2, 0) '返回识别结果字符的指针,第四个参数为网络地址

no2 = lstrcpy(strResult, no1) '把识别结果放在strResult中

no2 = Writepic("c:\look.bmp")  '把获取的网络图片放在指定的路径,以用来显示,你也可以自己设置自己喜欢的保存路径。

Text1.Text = strResult

Picture1.Picture = LoadPicture("c:\look.bmp") '显示本次识别的图片

End Sub



我从别人做的识别系统内提出ycode.dll, y300xxxx.cll,yxxxx.cll 3个库文件,放到vb程序目录下,正常调用,但每当调用函数的时候就出现错误, 提示内存 ****位置不能为read。识别库没有问题,用我自己的和其他的都一样,是不是我的库文件本身有毛病?

Private Declare Function loadcode Lib "ycode.dll" (ByVal code As Long, ByVal Length As Long, ByVal address As String, ByVal pass As String) As Long
Private Declare Function Recognition Lib "ycode.dll" (ByVal ItemNo As Long, ByVal picin As Long, ByVal Length As Long, ByVal Address1 As String, ByVal Address2 As String, lppicout As Long, lpLength As Long, cLength As Long) As Long
Private Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" (ByVal lpString1 As String, ByVal lpString2 As Long) As Long
Private Declare Function Writepic Lib "ycode.dll" (ByVal c As String) As Long
Dim noo As Long
Dim jieguo As String '识别结果
Dim no1 As Long
Dim no2 As Long
Dim n1 As Long '图片指针
Dim n2 As Long '指针长度

Private Sub Command1_Click()
'采用传递网络验证码路径方式
jieguo = " " '验证码都是4个字符的先初始一个4个字节的空白字符串,对于字母长度不定的可以通过Recognition的第8个参数获取字母长度
no1 = Recognition(1, 0, 0, "http://members.china., "", n1, n2, 0) '返回识别结果字符的指针
no2 = lstrcpy(jieguo, no1) 'VB中用lstrcpy就可以从指针得到字符了,当然你也可以选择其他的方式
no2 = Writepic("") '这行代码的目的是把图片解码成bmp图片,可选。
Text1.Text = jieguo
Picture1.Picture = LoadPicture("c:\code.bmp")

End Sub

Private Sub Command2_Click()
'采用传递本地验证码图片方式
jieguo = " " '验证码都是4个字符的先初始一个4个字节的空白字符串,对于字母长度不定的可以通过Recognition的第8个参数获取字母长度
no1 = Recognition(1, 0, 0, "", "ci.GIF", n1, n2, 0) '返回识别结果字符的指针
no2 = lstrcpy(jieguo, no1) 'VB中用lstrcpy就可以从指针得到字符了,当然你也可以选择其他的方式
no2 = Writepic("") '这行代码的目的是把图片解码成bmp图片,可选。
Text1.Text = jieguo
Picture1.Picture = LoadPicture("c:\code.bmp")
End Sub
2022-06-24 14:58
aroffice
Rank: 2
等 级:论坛游民
帖 子:56
专家分:20
注 册:2011-9-23
收藏
得分:0 
回复 2楼 吹水佬
这是网上找的VB代码,需要修改为VFP的代码

程序代码:
Private Declare Function loadcode Lib "ycode.dll" (ByVal code As Long, ByVal Length As Long, ByVal address As String, ByVal pass As String) As Long
Private Declare Function Recognition Lib "ycode.dll" (ByVal ItemNo As Long, ByVal picin As Long, ByVal Length As Long, ByVal Address1 As String, ByVal Address2 As String, lppicout As Long, lpLength As Long, cLength As Long) As Long
Private Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" (ByVal lpString1 As String, ByVal lpString2 As Long) As Long
Private Declare Function Writepic Lib "ycode.dll" (ByVal c As String) As Long
Dim strResult As String '识别结果
Dim no1 As Long
Dim no2 As Long
Dim n1 As Long '图片指针
Dim n2 As Long '指针长度

Private Sub Form_Load()
no1 = loadcode(0, 0, "myfc.fc", "") '载入验证码库,把路径换成你的库,当然你也可以直接传递数据,返回项目个数,最后一个参数为库文件密码,如果库文件有密码,这里必须加上
End Sub

Private Sub Command1_Click()

strResult = "    " '验证码都是4个字符的先初始一个4个字节的空白字符串,对于字母长度不定的可以通过Recognition的第8个参数获取字母长度

no1 = Recognition(1, 0, 0, "http://passport., "", n1, n2, 0) '返回识别结果字符的指针,第四个参数为网络地址

no2 = lstrcpy(strResult, no1) '把识别结果放在strResult中

no2 = Writepic("c:\look.bmp")  '把获取的网络图片放在指定的路径,以用来显示,你也可以自己设置自己喜欢的保存路径。

Text1.Text = strResult

Picture1.Picture = LoadPicture("c:\look.bmp") '显示本次识别的图片

End Sub



我从别人做的识别系统内提出ycode.dll, y300xxxx.cll,yxxxx.cll 3个库文件,放到vb程序目录下,正常调用,但每当调用函数的时候就出现错误, 提示内存 ****位置不能为read。识别库没有问题,用我自己的和其他的都一样,是不是我的库文件本身有毛病?

Private Declare Function loadcode Lib "ycode.dll" (ByVal code As Long, ByVal Length As Long, ByVal address As String, ByVal pass As String) As Long
Private Declare Function Recognition Lib "ycode.dll" (ByVal ItemNo As Long, ByVal picin As Long, ByVal Length As Long, ByVal Address1 As String, ByVal Address2 As String, lppicout As Long, lpLength As Long, cLength As Long) As Long
Private Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" (ByVal lpString1 As String, ByVal lpString2 As Long) As Long
Private Declare Function Writepic Lib "ycode.dll" (ByVal c As String) As Long
Dim noo As Long
Dim jieguo As String '识别结果
Dim no1 As Long
Dim no2 As Long
Dim n1 As Long '图片指针
Dim n2 As Long '指针长度

Private Sub Command1_Click()
'采用传递网络验证码路径方式
jieguo = " " '验证码都是4个字符的先初始一个4个字节的空白字符串,对于字母长度不定的可以通过Recognition的第8个参数获取字母长度
no1 = Recognition(1, 0, 0, "http://members.china./ci.jpg", "", n1, n2, 0) '返回识别结果字符的指针
no2 = lstrcpy(jieguo, no1) 'VB中用lstrcpy就可以从指针得到字符了,当然你也可以选择其他的方式
no2 = Writepic("") '这行代码的目的是把图片解码成bmp图片,可选。
Text1.Text = jieguo
Picture1.Picture = LoadPicture("c:\code.bmp")

End Sub

Private Sub Command2_Click()
'采用传递本地验证码图片方式
jieguo = " " '验证码都是4个字符的先初始一个4个字节的空白字符串,对于字母长度不定的可以通过Recognition的第8个参数获取字母长度
no1 = Recognition(1, 0, 0, "", "ci.GIF", n1, n2, 0) '返回识别结果字符的指针
no2 = lstrcpy(jieguo, no1) 'VB中用lstrcpy就可以从指针得到字符了,当然你也可以选择其他的方式
no2 = Writepic("") '这行代码的目的是把图片解码成bmp图片,可选。
Text1.Text = jieguo
Picture1.Picture = LoadPicture("c:\code.bmp")
End Sub
2022-06-24 14:59
aroffice
Rank: 2
等 级:论坛游民
帖 子:56
专家分:20
注 册:2011-9-23
收藏
得分:0 
链接: https://pan.baidu.com/s/175prV4GKi1MlSw5gcI3fNA?pwd=key9 提取码: key9 复制这段内容后打开百度网盘手机App,操作更方便哦
2022-06-24 15:51
快速回复:VFP 引用DLL 显示错误
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.028699 second(s), 12 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved