医保数据下载保存交易
int GetMedicareData(char* DownType, char* StartTime, char* UnitNo, int* AppCode ,char* DataBuffer);
(东软说是用VC写的DLL中的一个函数)Function GetMedicareData(downtype:pchar;starttime:pchar;unitno:pchar;appcode:integer;databuffer:pchar):integer;stdcall;external 'DBLib.dll';(这个是我在DELPHI里引用的,总是报错)Function GetMedicareData(downtype:string;starttime:string;unitno:string;appcode:integer;databuffer:string):integer;stdcall;external 'DBLib.dll';这样写也是错,
不知道什么原因,急...
还有,如何写一个为databuffer赋值的语句,我用getmem(buf,1024)时,运行到调用getmedicaredata时程序就挂了,
(VB下有一个buf=space(1024)的语句,就可以,但是VB里是STRING类型的)请大家帮忙看一下,

解决方案 »

  1.   

    Function   GetMedicareData(downtype:pchar;starttime:pchar;unitno:pchar;appcode:integer;databuffer:pchar):integer;stdcall;external   'DBLib.dll ';(这个是我在DELPHI里引用的,总是报错) 
    =================================================================================================
    参数类型appcode:integer不正确,应该是appcode:Pinteger。如果appcode是输出参数,也可写成var appcode:integer
      

  2.   

    appcode和databuffer都是出参,这个函数会在本地建一个文件,并把医保中心一个表中的数据写在这个文本文件里,
      

  3.   

    无论appcode是什么参数,反正是个指针,都可写成appcode:Pinteger,只是如果输出参数,写成var appcode:integer更符合Delphi习惯而已(相当于c++引用)
      

  4.   

    to maozefa 老大,你的答案是正确的,我按你说的var appcode:integer写进去后,就OK了,下载医保数据成功,但是还有个问题,刚刚写的这个函数是东软在医保动态库DBLIB.DLL中的一个函数,用这个方法可以实现了,
    但是,之前我在东软做的农村合作医疗动态库SiInterface.dll(不是同一个软件开发组做的)时,直接写appcode:INTEGERYI 就不报错,,这个是不是和写的VC DLL有关系呢?
      

  5.   


      先把分给了,多谢 maozefa