向窗體上添加兩個TLabel組件

首先聲明NetMessageBufferSend函數
type
NET_API_STATUS = LongInt;
function NetMessageBufferSend(servername: LPCWSTR; msgname: LPCWSTR;
fromname: LPCWSTR; buf: Pointer;
buflen: DWORD): NET_API_STATUS;
stdcall;external
在程序運行過程中
procedure TForm
var
WideMsg:PWideChar;
DestName:PWideChar;
begin
DestName:=PWideChar(WideString(Edit
WideMsg:=PWideChar(WideString(Edit
NetMessageBufferSend(nil
end;
程序代碼如下
unit Unit
interface
uses
Windows
Dialogs
type
NET_API_STATUS = LongInt;
function NetMessageBufferSend(servername: LPCWSTR; msgname: LPCWSTR;
fromname: LPCWSTR; buf: Pointer;
buflen: DWORD): NET_API_STATUS;
stdcall;external
type
TForm
Edit
Label
Label
Edit
Button
procedure Button
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form
implementation
{$R *
procedure TForm
var
WideMsg:PWideChar;
DestName:PWideChar;
begin
DestName:=PWideChar(WideString(Edit
WideMsg:=PWideChar(WideString(Edit
NetMessageBufferSend(nil
end;
end
保存文件

在Computer對應的文本框中輸入目的計算機名
單擊Send按鈕


From:http://tw.wingwit.com/Article/program/Delphi/201311/8402.html