调用其它dll文件 |
答題得分者是:ouyongke
|
interhb
一般會員 發表:1 回覆:0 積分:0 註冊:2013-07-03 發送簡訊給我 |
dll文件:SiInterface.dll
函数名称 BUSINESS_HANDLE 功能描述: 调用执行各交易,进行各种业务处理 调用语法: int BUSINESS_HANDLE (const char* inputData,char* outputDat) 参数描述: 参数标识 参数名称 数据类型 输入输出 inputData 输入数据 char* IN outputData 输出结果 char* OUT 在dll中调用 procedure TForm1.Button2Click(Sender: TObject); //调用人员信息 type Tdll=function(const inputData: pchar;var outputDat:Pchar): integer;stdcall;//cdecl;// var DllInstance:THandle; pFunc:TFarProc; str1:string; str_input,str_output:Pchar; N:INTEGER; begin DllInstance:=loadlibrary(pchar('SiInterface.dll')); if DllInstance<>0 then pFunc:=GetProcaddress(DllInstance, 'BUSINESS_HANDLE'); showmessage('1'); if pFunc <> nil then begin N:=Tdll(pFunc)(pchar('01'),str_output); // showmessage('2'); end freelibrary(DllInstance); showmessage('完成'); end; 能够执行到最后一步,但点击最后一提示框(消息:完成)后,程序出现死机状态,等一会出现提示:程序已停止工作,出现一个问题,导致程序停止正常工作,如有可用的解决方案,Windows将关闭程序通知你; 调试和关闭程序两按钮. 请指点一个是什么原因呀!! |
P.D.
版主 發表:603 回覆:4038 積分:3874 註冊:2006-10-31 發送簡訊給我 |
|
tuga
高階會員 發表:16 回覆:109 積分:120 註冊:2002-07-13 發送簡訊給我 |
|
chenyk
高階會員 發表:14 回覆:95 積分:171 註冊:2002-07-08 發送簡訊給我 |
|
ouyongke
一般會員 發表:2 回覆:6 積分:6 註冊:2003-05-09 發送簡訊給我 |
樓主怎麼跑臺灣的論壇裏問大陸的醫保接口問題啊
我一看這個DLL的名字, 我就知道這是東軟的醫保接口, 好惡心啊 時間過了這麼久了, 也不知道我的代碼是不是還對你有用, 这是我在公司用的代码, 使用下面的CALLFUN()就OK [code delphi] var YBHandle: integer; // DLL句柄 const sDllName='SiInterface.dll'; // DLL檔案名 // Load DLL File function THNJBProc.LoadYBLib:Boolean; var pDLLName:PChar; begin result:=true; if YBHandle=0 then begin GetMem(pDLLName,Length(sDllName) 1); try StrPCopy(pDLLName,sDllName); YBHandle := LoadLibrary(pDLLName); finally FreeMem(pDLLName); end; if YBHandle = 0 then begin MessageDlg(format('装入%s失败,可能该文件不存在!',[sDllName]),mtError,[mbOK],0); result := False; end; end; end; // Free Dll File procedure THNJBProc.FreeLib; begin if YBHandle <> 0 then FreeLibrary(YBHandle); YBHandle := 0; end; function THNJBProc.CallFUN(InputData:String; var OutPutData:String):Integer; var AFUNC: function(AInput, AOutput: PChar): Integer; stdcall; Pinput, Poutput: PChar; sOutPut: string; begin Result := -1; try if LoadYBLib then begin GetMem(Pinput,2048); GetMem(Poutput,2048); try sOutPut := ''; StrPCopy(Pinput,InputData); StrPCopy(Poutput,sOutPut); @AFUNC := GetProcAddress(YBHandle, 'BUSINESS_HANDLE'); if @AFUNC <> nil then begin Result := AFUNC(Pinput,Poutput); sOutPut := Poutput; OutPutData := sOutPut; //RZini.WriteString(sTimeStr,'执行结果(0:成功,小于0:失败)',IntToStr(Result)); //RZini.WriteString(sTimeStr,'返回消息',sOutPut); end; finally FreeMem(Pinput); FreeMem(Poutput); end; end; except on E:Exception do ShowMessage('调用BUSINESS_HANDLE出现错误:' E.Message); end; end; [/code]
------
城市里, 我像一粒尘埃, 默默地存在... |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |