Y
ykjt
Unregistered / Unconfirmed
GUEST, unregistred user!
编译通过,但目标机器上没反应
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
NET_API_STATUS = LongInt;
function NetMessageBufferSend(servernameWideChar; msgnameWideChar;fromnameWideChar; bufwidechar; buflen:integer):NET_API_STATUS;stdcall;external 'netapi32.dll';
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
msgWideChar;
destnameWideChar;
begin
destname:=pwidechar(widestring(Edit1.Text)); //目标机器名
msg:=pwidechar(WideString(Edit2.Text)); //发送内容
NetMessageBufferSend(nil,destname,nil,msg,length(Edit2.Text)*2);
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
NET_API_STATUS = LongInt;
function NetMessageBufferSend(servernameWideChar; msgnameWideChar;fromnameWideChar; bufwidechar; buflen:integer):NET_API_STATUS;stdcall;external 'netapi32.dll';
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
msgWideChar;
destnameWideChar;
begin
destname:=pwidechar(widestring(Edit1.Text)); //目标机器名
msg:=pwidechar(WideString(Edit2.Text)); //发送内容
NetMessageBufferSend(nil,destname,nil,msg,length(Edit2.Text)*2);
end;
end.