现想调用一DLL,但弄了N久调用不了,关于这个DLL手上只有一个用BCB调用的实例,下面列出其中的一个过程这是DLL的过程在BCB中的引用InitVCDSystem
EXTERN class __stdcall VideoDetect
{
public:
bool InitVCDSystem();
}1.在DELPHI中静态引用:
function InitVCDSystem(): Boolean; stdcall external 'VCD.dll';
调用时提示:
无法定位程序输入点InitVCDSystem于动太链接库VCD.DLL上
2.在DELPHI中动态引用:type
TIntFunc= function(): Boolean; stdcall;
var
Th:Thandle;
Tf:TIntFunc;
Tp:TFarProc;
test: boolean;
begin
Th:=LoadLibrary('VCDDll.dll'); {装载DLL}
if Th>0 then
try
Tp:=GetProcAddress(Th,'InitVCDSystem');
if Tp<>nil then
begin
Tf:=TIntFunc(Tp);
test := Tf;
end
else
ShowMessage('InitVCDSystem函数没有找到');
finally
FreeLibrary(Th); {释放DLL}
end
else
ShowMessage('VCDDll.dll没有找到');执行时Tp=nil3.后来通过一个查看一个DLL的工具查出InitVCDSystem的函数名为@VideoDetect@InitVCDSystem$qqsv,于是把
代码改为:
Th:=LoadLibrary('VCDDll.dll'); {装载DLL}
if Th>0 then
try
Tp:=GetProcAddress(Th,'@VideoDetect@InitVCDSystem$qqsv');//<---改了这里的函数名称
if Tp<>nil then
begin
Tf:=TIntFunc(Tp);
test := Tf; //<----执行到这里出错
end
else
ShowMessage('InitVCDSystem函数没有找到');
finally
FreeLibrary(Th); {释放DLL}
end
else
ShowMessage('VCDDll.dll没有找到');
错误提示如下:
access violation at 0x00f4883;write of address 0x004499d8有个非常不明白的地方就是:在BCB中的引用名称是InitVCDSystem,为什么在DELPHI中用此名称返回的地址为空?难道是DLL本身的问题?各位指点一下吧,实在找不出原因了
EXTERN class __stdcall VideoDetect
{
public:
bool InitVCDSystem();
}1.在DELPHI中静态引用:
function InitVCDSystem(): Boolean; stdcall external 'VCD.dll';
调用时提示:
无法定位程序输入点InitVCDSystem于动太链接库VCD.DLL上
2.在DELPHI中动态引用:type
TIntFunc= function(): Boolean; stdcall;
var
Th:Thandle;
Tf:TIntFunc;
Tp:TFarProc;
test: boolean;
begin
Th:=LoadLibrary('VCDDll.dll'); {装载DLL}
if Th>0 then
try
Tp:=GetProcAddress(Th,'InitVCDSystem');
if Tp<>nil then
begin
Tf:=TIntFunc(Tp);
test := Tf;
end
else
ShowMessage('InitVCDSystem函数没有找到');
finally
FreeLibrary(Th); {释放DLL}
end
else
ShowMessage('VCDDll.dll没有找到');执行时Tp=nil3.后来通过一个查看一个DLL的工具查出InitVCDSystem的函数名为@VideoDetect@InitVCDSystem$qqsv,于是把
代码改为:
Th:=LoadLibrary('VCDDll.dll'); {装载DLL}
if Th>0 then
try
Tp:=GetProcAddress(Th,'@VideoDetect@InitVCDSystem$qqsv');//<---改了这里的函数名称
if Tp<>nil then
begin
Tf:=TIntFunc(Tp);
test := Tf; //<----执行到这里出错
end
else
ShowMessage('InitVCDSystem函数没有找到');
finally
FreeLibrary(Th); {释放DLL}
end
else
ShowMessage('VCDDll.dll没有找到');
错误提示如下:
access violation at 0x00f4883;write of address 0x004499d8有个非常不明白的地方就是:在BCB中的引用名称是InitVCDSystem,为什么在DELPHI中用此名称返回的地址为空?难道是DLL本身的问题?各位指点一下吧,实在找不出原因了
解决方案 »
- Resourcestring用法
- 帮我解决一个问题!很easy!在线等待!
- 如何在DELPHI写基于ASP的activex或其他组件?很简单,给个例子即可
- 如何把qtintf70.dll编译进可执行文件,这样在发布程序的时候就不用拷贝这个文件了
- 有没有更快一点的办法来测试数据库连接是否成功?■■■■■■■■■■■
- delphi新丁请求急救!BDE连接远程数据库问题!!(100分)
- 很菜的问题
- 这样在遍历数据库中的表名?
- 用OleContainer打开word,如何只读?
- 关于作仪表控件的问题,怎样画指针,刻度。
- QuickRep的问题:如何在一个QuickRep的上面放置3个DetailBand,分别对应3个ADOQuery
- 请教一个窗体的设计思路,功能是编辑一条记录,实现保存功能时,要有几个按钮相互搭配呀?
begin
Tf:=TIntFunc(Tp);
test := Tf; //<----执行到这里出错
end修改为Tp<> nil then
test := tp();试试。另外能确认dll里面是@VideoDetect@InitVCDSystem$qqsv' 这个妖怪名字么? 用静态的方式再试试
类的成员函数是8位指针(BCB中为__closure类型),你用普通的方法是不能调用的