源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 open
ULONG PA_FileOpen(UCHAR mode, ULONG &handle, char* fileName);

解决方案 »

  1.   

    function PA_FileOpen(Mode: Byte; out Handle: THandle; const FileName: PAnsiChar): Cardinal cdecl;
      

  2.   

    http://www.drbob42.com/tools/index.htmHeadConv v4.20
    看看他的说明就明白了。
      

  3.   


    谢谢。
    再请教:为什么我在调用的时候,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;
      

  4.   


    function PA_FileOpen(Mode: Byte;var Handle: THandle; const FileName: PAnsiChar): Cardinal cdecl;
      

  5.   


    其实开始用得就是var,后来试了out,还是不行;
    很可能是调用代码那里出了什么问题,只是需要高手来给看看!
      

  6.   


    这里const FileName: PAnsiChar;似乎不应该用Const关键字
    1. 这里h是打开文件返回的Handle值
    注释写的很清楚
    handle --- out ---this function will return a handle when file open success 2. 文件名'111.txt'把路径写全名'C:\111.txt'.
      

  7.   

    PA_FileOpen: function(mode: UCHAR; 
                            var handle: ULONG; 
                            fileName: PChar): ULONG cdecl  {$IFDEF WIN32} stdcall {$ENDIF};