delphi 动态数组传递数据示例


本文整理自网络,侵删。

 unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

Type
TMyByteArr = array of Byte;

procedure Proc(inArr: TMyByteArr; var OutArr: TMyByteArr);
begin
SetLength(OutArr, Length(inArr));
Move(inArr, outArr, Length(inArr));
end;

procedure TForm1.Button1Click(Sender: TObject);
var
arr1,arr2: TMyByteArr;
i: Integer;
str: string;
begin
SetLength(arr1, 3);
arr1[0] := 11;
arr1[1] := 22;
arr1[2] := 33;

Proc(arr1, arr2);
for i := 0 to Length(arr2) - 1 do str := Format('%s %d', [str, arr2[i]]);
ShowMessage(TrimLeft(str)); {11 22 33}
end;

end.

相关阅读 >>

Delphi下ado的多线程编程

Delphi 控制窗口显示隐藏

Delphi下载网站文件(支持https协议)

Delphi twebbrowser:确定带有框架的页面何时完成

Delphi 使用edge browser浏览器组件

Delphi 判断操作系统是否是64位的函数

Delphi通过wmi获取系统信息

Delphi unigui确认对话框

Delphi中bitmap位图与base64字符串相互转换

Delphi如何实现模拟组合按键,如发送ctrl_f的按键消息

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...