再请教,vc的动态库函数,在delphi下如何声明?(200)

  • 主题发起人 主题发起人 keynexy
  • 开始时间 开始时间
K

keynexy

Unregistered / Unconfirmed
GUEST, unregistred user!
vc源函数说明如下://(34) open an existed file on private area, return a handle when success,//#define PFILE_OPEN 0x01 ---- mode//#define PFILE_CREATE 0x02 ---- mode// mode ---in --- file open mode , PFILE_OPEN (when file is existed),// PFILE_CREATE (when file is not existed)// handle --- out ---this function will return a handle when file open success// filename --- in ---file name to openULONG PA_FileOpen(UCHAR mode, ULONG &handle, char* fileName);
 
参考http://topic.csdn.net/t/20041130/18/3602936.htmlhttp://blog.csdn.net/zhuqinglu/archive/2008/08/22/2816288.aspx
 
再请教:为什么我在调用的时候,handle返回总是0? 以下是我的源码, 声明: PA_FileOpen=function(mode:byte;out handle:THandle;const fileName:pansichar):Cardinal;cdecl;
调用: procedure TForm1.btnClick(Sender:TObject);
var PFunc:TFarProc;
bn:cardinal;
h:Thandle;
begin
PFunc:=GetProcAddress(Udll,'PA_FileOpen');
if PFunc <>nil then
begin
bn:=PA_FileOpen(PFunc)(2,h,'111.txt');
if bn <>0 then
raise exception.Create('文件创建失败!!') else
showmessage(inttostr(h));
end else
showmessage('不能找到函数入口!');
end;
 
试试这个:PA_FileOpen=function(mode:byte;var handle:THandle;const fileName:pansichar):Cardinal;cdecl;
 
var,out都试了,handle返回总是0
 
DLL本身问题。
 
PA_FileOpen=function(mode:byte;var handle:DWord;fileName:pchar):DWord;stdcall;
 
感谢大家的参与,虽然至今没有解决问题
 

Similar threads

I
回复
0
查看
601
import
I
I
回复
0
查看
632
import
I
I
回复
0
查看
2K
import
I
I
回复
0
查看
3K
import
I
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
后退
顶部