| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 725 人关注过本帖
标题:关于VB6呼叫自制的DLL的疑问
取消只看楼主 加入收藏
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:23
帖 子:1820
专家分:3681
注 册:2011-3-24
结帖率:97.66%
收藏
已结贴  问题点数:20 回复次数:4 
关于VB6呼叫自制的DLL的疑问
用VC6写了一只DLL~再用VB6中去载入~
奇怪的是有时正常有时不正常~
是不是除了VB6档头要声明外~
还要用什么API载入DLL的资源才行吗?

特别是用For循环连续运行DLL时~
几乎每次都失败~

不用循环连续运行就比较正常~
这是什么原因呢?

额外加问这比较不重要~我有后制处理有疑似解决~
明明有VC6的传回Bool值~但是VB6中确无法直接认出来~
还要另外写IIf判断式处理~这又为何?

用Debug.Print看到用VC6返回True~但是却不能直接等于VB6的True~
好奇怪~
搜索更多相关主题的帖子: 有时 自制 资源 
2012-02-17 22:35
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:23
帖 子:1820
专家分:3681
注 册:2011-3-24
收藏
得分:0 
回复 2楼 bczgvip
VC:

bool _stdcall ST2AT(int,int,char*,char*,char*);                //功能函式:STDF转ATDF
bool _stdcall AT2ST(int,int,char*,char*,char*);                //功能函式:ATDF转STDF
bool _stdcall ST2MG(int,int,char*,char*,char*);                //功能函式:STDF档案合并
bool _stdcall AT2MG(int,int,char*,char*,char*);                //功能函式:ATDF档案合并
bool _stdcall ST2SP(int,int,char*,char*,char*);                //功能函式:STDF档案切割

VB:

Public Declare Function ST2MG Lib "FMain.dll" (ByVal opt As Integer, ByVal FCount As Integer, ByVal FileName As String, ByVal TmpFileNameStr As String, ByVal E_FileName As String) As Boolean
Public Declare Function ST2AT Lib "FMain.dll" (ByVal opt As Integer, ByVal FCount As Integer, ByVal FileName As String, ByVal TmpFileNameStr As String, ByVal E_FileName As String) As Boolean
Public Declare Function AT2ST Lib "FMain.dll" (ByVal opt As Integer, ByVal FCount As Integer, ByVal FileName As String, ByVal TmpFileNameStr As String, ByVal E_FileName As String) As Boolean
Public Declare Function AT2MG Lib "FMain.dll" (ByVal opt As Integer, ByVal FCount As Integer, ByVal FileName As String, ByVal TmpFileNameStr As String, ByVal E_FileName As String) As Boolean
Public Declare Function ST2SP Lib "FMain.dll" (ByVal opt As Integer, ByVal FCount As Integer, ByVal FileName As String, ByVal TmpFileNameStr As String, ByVal E_FileName As String) As Boolean

def映射档:

;FMain.def
LIBRARY FMain
EXPORTS
  ST2MG @1
  ST2AT @2
  AT2MG @3
  ST2SP @4

映射是少一个~但是那个目前没用到~VB里也没呼叫到~

不要選我當版主
2012-02-20 00:03
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:23
帖 子:1820
专家分:3681
注 册:2011-3-24
收藏
得分:0 
少的那个是因为IEEE754标准协定的缘故~
除不尽的4Bytes(高低位元倒反)的小数转成ASCII码后~
就再也转不回原本的二进制了~
不信你可以试试~
会越转差距越大~
那是写到一半才发现的~~
所以我无法克服~
就没写了~

不要選我當版主
2012-02-20 00:10
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:23
帖 子:1820
专家分:3681
注 册:2011-3-24
收藏
得分:0 
结论是~
跟上面每个人(包含我)怀疑的都无关的地方~
因为我是手动黏贴发行版的DLL档~
里面没有内含调试功能~所以无法进行调试~

发行版的DLL档~无法进行代码调试~

然后VB的声明函式返回值改为长整型~
VC的函式返回值改为1 or 0~
就一切OK了~

另外开了个MFC DLL的工程~
把原本的全部转过去~重新编译~
所以原本不能用的东西都能用了~
不用再额外加代码~

中间也碰到过C版某位同志贴的的问题~
再来VB要传控件句柄让VC控制VB的介面变换~
和玩玩多线程~

不要選我當版主
2012-02-20 20:40
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:23
帖 子:1820
专家分:3681
注 册:2011-3-24
收藏
得分:0 
VC:

int _stdcall ST2AT(int,int,char&,char&,char&);                //功能函式:STDF转ATDF
int _stdcall AT2ST(int,int,char&,char&,char&);                //功能函式:ATDF转STDF
int _stdcall ST2MG(int,int,char&,char&,char&);                //功能函式:STDF档案合并
int _stdcall AT2MG(int,int,char&,char&,char&);                //功能函式:ATDF档案合并
int _stdcall ST2SP(int,int,char&,char&,char&);                //功能函式:STDF档案切割

VB:

Public Declare Function ST2MG Lib "FMain.dll" (ByVal opt As Integer, ByVal FCount As Integer, ByRef FileName As String, ByRef TmpFileNameStr As String, ByRef E_FileName As String) As Long
Public Declare Function ST2AT Lib "FMain.dll" (ByVal opt As Integer, ByVal FCount As Integer, ByRef FileName As String, ByRef TmpFileNameStr As String, ByRef E_FileName As String) As Long
Public Declare Function AT2ST Lib "FMain.dll" (ByVal opt As Integer, ByVal FCount As Integer, ByRef FileName As String, ByRef TmpFileNameStr As String, ByRef E_FileName As String) As Long
Public Declare Function AT2MG Lib "FMain.dll" (ByVal opt As Integer, ByVal FCount As Integer, ByRef FileName As String, ByRef TmpFileNameStr As String, ByRef E_FileName As String) As Long
Public Declare Function ST2SP Lib "FMain.dll" (ByVal opt As Integer, ByVal FCount As Integer, ByRef FileName As String, ByRef TmpFileNameStr As String, ByRef E_FileName As String) As Long

不要選我當版主
2012-02-20 23:00
快速回复:关于VB6呼叫自制的DLL的疑问
数据加载中...
 
   



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

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