有个dll(应该是用vc做的),我要在delphi 6调用,但始终出错,请各位看看毛病在哪?
函数说明(vc调用例程里的)
extern "C" __declspec(dllexport) bool _stdcall OpenDataBase(HWND hMainWnd); //打开数据源 返回true 成功 返回false 失败我的调用程序如下:type
TFunc =function(hMainWnd:hwnd):boolean;stdcall;
var
handle:Thandle;
Tf:TFunc;
Tp:TFarProc;
begin
handle :=LoadLibrary('CXK.dll'); {load dll}
if(handle>0) then
try
Tp :=GetProcAddress(handle,PChar('OpenDataBase'));
if(Tp <>nil) then
begin
Tf :=TFunc(Tp);
if Tf(handle) then //此句出错!!!!
ShowMessage('ok.');
end
else
ShowMessage('function not found.');
finally
FreeLibrary(handle);
end;
我用vc调用就没问题
函数说明(vc调用例程里的)
extern "C" __declspec(dllexport) bool _stdcall OpenDataBase(HWND hMainWnd); //打开数据源 返回true 成功 返回false 失败我的调用程序如下:type
TFunc =function(hMainWnd:hwnd):boolean;stdcall;
var
handle:Thandle;
Tf:TFunc;
Tp:TFarProc;
begin
handle :=LoadLibrary('CXK.dll'); {load dll}
if(handle>0) then
try
Tp :=GetProcAddress(handle,PChar('OpenDataBase'));
if(Tp <>nil) then
begin
Tf :=TFunc(Tp);
if Tf(handle) then //此句出错!!!!
ShowMessage('ok.');
end
else
ShowMessage('function not found.');
finally
FreeLibrary(handle);
end;
我用vc调用就没问题
解决方案 »
- 第一次接触DELPHI,关于连数据库的东东。
- InterBase7.1的驱动哪里有?
- 在Dll(VB写的ActiveX)中调用VCL控件
- 在dxDBGrid控件中已选择多行数据,如何得到被选中的行?
- 关于dll与应用程序的通信问题?
- 下面这段代码为什么不能用adocommand更新到数据库中,而在sqlserver查询分析器中可以执行?脚本见内容,
- ■■■送大家一个小东西,也许用得着■■■
- 如何在dbgid中修改用query查找出的值??
- memo的内容需要通过什么方式能存到数据库的memo里?
- 我有一个dbgrid控件,里面有多条记录,我现在想把一些常用的记录用鼠标拉到dbgrid的最上面,请问怎么做?
- 请人写一个网吧专用的三层更新软件
- 为什么修改表里的数据说会出错,有兴趣的快近来看看
handle:Thandle; //这个变量名用的有些问题, 最好换一个