Q
quietsky
Unregistered / Unconfirmed
GUEST, unregistred user!
各位高手,小弟刚学delphi,有个小程序搞不懂,编译报错请,高手指点.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
NET_API_STATUS = LongInt;
function netmessagebuffersend(servernamewidechar;tonamewidechar;fromnamewidechar;bufwidechar;var buflen:integer):integer;stdcall; external 'netapi32.dll' name 'netmessagebuffersend';
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
Label3: TLabel;
Edit3: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Form1=TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
edit1.Clear;
edit2.Clear;
edit3.Clear;
end;
procedure TForm1.Button2Click(Sender: TObject);
const
max_length=1025;
var
string1,string2,string3:string;
pstring1,pstring2:array[0..28] of widechar;
pstring3:array[0..1024] of widechar;
i,j,length:integer;
begin
string1:=edit1.Text;
string2:=edit2.Text;
string3:=edit3.Text;
for i:=0 to 28 do
begin
pstring1:=#0;
stringtowidechar(string1,pstring1,length);
pstring2:=#0;
stringtowidechar(string2,pstring2,length);
pstring3:=#0;
stringtowidechar(string3,pstring3,length);
end;
j:=netmessagebuffersend(nil,pstring2,pstring1,pstring3,max_length);
end;
end.
报错如下:
[Error] Unit1.pas(64): Types of actual and formal var parameters must be identical
[Fatal Error] Project2.dpr(5): Could not compile used unit 'Unit1.pas'
谢谢!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
NET_API_STATUS = LongInt;
function netmessagebuffersend(servernamewidechar;tonamewidechar;fromnamewidechar;bufwidechar;var buflen:integer):integer;stdcall; external 'netapi32.dll' name 'netmessagebuffersend';
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
Label3: TLabel;
Edit3: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Form1=TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
edit1.Clear;
edit2.Clear;
edit3.Clear;
end;
procedure TForm1.Button2Click(Sender: TObject);
const
max_length=1025;
var
string1,string2,string3:string;
pstring1,pstring2:array[0..28] of widechar;
pstring3:array[0..1024] of widechar;
i,j,length:integer;
begin
string1:=edit1.Text;
string2:=edit2.Text;
string3:=edit3.Text;
for i:=0 to 28 do
begin
pstring1:=#0;
stringtowidechar(string1,pstring1,length);
pstring2:=#0;
stringtowidechar(string2,pstring2,length);
pstring3:=#0;
stringtowidechar(string3,pstring3,length);
end;
j:=netmessagebuffersend(nil,pstring2,pstring1,pstring3,max_length);
end;
end.
报错如下:
[Error] Unit1.pas(64): Types of actual and formal var parameters must be identical
[Fatal Error] Project2.dpr(5): Could not compile used unit 'Unit1.pas'
谢谢!