前段时间有个软件开发商用.net 做了一DLL 程序。函数中有string 字符串我用delphi 调用不管用什么方法就是失败。不知何故!是不是string 要初始化?也不行。高手指点。
解决方案 »
- 线程问题:在DLL中调用另一个DLL中的线程为什么不执行OnTerminate.
- DBGRID问题---急
- delphi 的右移操作符是什么呀?
- 引用DLL后,程序退出有报错,DLL会受传入的参数类型不同而影响!为什么
- 菜鸟刚入门,问:当菜单上的代码和按按钮代码相同时,代码放什么地方?
- 还是关于as关键字的问题
- 如何改变DBGridEh 3.0 中网格线的颜色? 记得以前版本有这个属性linecolor
- Panel的问题,解决马上给分!!!!!!!!!!!!
- ListView的问题
- 怎样改变Tdbgrid的底色?
- 如何获取某个控件的光标图片,将它旋转后重新生成一个新的光标?
- 关于Idhttp+线程类的疑问。
原生的数据类型才是王道。
errtext As String
out1 As String
out2 As String
End TypePublic Type str_in
ybjgbm As String
yybm As String
End TypeSub init_type(par_in As str_in, par_out As str_out)With par_in
.ybjgbm = "430700"
.yybm = "4307000001"
End With
par_out.errtext = Space(1024)
par_out.out1 = Space(50)
par_out.out2 = Space(50)End SubPrivate Sub Command1_Click()
Dim bln_return As Boolean
Dim par_in As str_in
Dim par_out As str_out
init_type par_in, par_outPublic Declare Function readzfbl Lib "cxybclient.dll" ( _
ByVal strybjgbm As String, ByVal stryybm As String _
, ByVal stryycxbm As String, ByVal strbz As String _
, strout As str_out) As Boolean上面是用VB 调可以调用动态链接库里面的函数.下面是delphi 调用
(1、)用记录
type
strout=record
errtext:string;
out1:string;
out2:string;
end;setlength(str_out.errtext,200); setlength(str_out.out1,50); setlength(str_out.out2,50);
(2、)类
type
strout=class
errtext:string;
out1:string;
out2:string;
end;var
xx:=strout.create;这两个都不能成功的调用动态链接库的函数。
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;Type str_out=record
errtext :Pchar;
out1 :Pchar;
out2 :Pchar;
out3 :Pchar;
out4 :Pchar;
out5 :Pchar;
out6 :Pchar;
out7 :Pchar;
out8 :Pchar;
out9 :Pchar;
out10 :Pchar;
out11 :Pchar;
out12 :Pchar;
out13 :Pchar;
out14 :Pchar;
out15 :Pchar;
out16 :Pchar;
out17 :Pchar;
out18 :Pchar;
out19 :Pchar;
out20 :Pchar;
out21 :Pchar;
out22 :Pchar;
out23 :Pchar;
out24 :Pchar;
out25 :Pchar;
out26 :Pchar;
out27 :Pchar;
out28 :Pchar;
out29 :Pchar;
out30 :Pchar;
End;var
Form1: TForm1;
FUNCTION readzfbl(ybjgbm:Pchar;yybm:Pchar;yycxbm:Pchar;strbz:Pchar;strout:str_out):Boolean; stdcall; external 'CxybClient.dll';
implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
par_out:str_out;
begin par_out:=str_out.Create; If readzfbl('430401', '4304010001', '123456', '1', par_out) Then
end;end.string类型改为PCHAR 也不行。。上面为了简化Public Type str_out
errtext As String
out1 As String
out2 As String
End Type
其实为31个字符串 调用函数时为返回值 每个字符串返回不同的值有成功失败等等
必须在COM组件中调用.net的DLL......