其实你可以调用netaip32.dll里的函数,这样你能获得更多的功能
请先声明
function NetMessageBufferSend(ServerName: PWideChar;
MsgName: PWideChar; FromName: PWideChar;
Buf: PWideChar; BufLen: integer): dword; stdcall;
external 'netapi32.dll' name 'NetMessageBufferSend';
然后你就可以用了:
function SendMsg(Proxy,Target,FromName, Msg: string): integer;
var Size: integer;
ProxyU: array[0..127] of widechar;
TargetU: array[0..127] of widechar;
FromNameU:array[0..127] of widechar;
MsgU: array[0..4091] of widechar;
begin
procedure TFormNetSendMessage.ButtonSendClick(Sender: TObject);
var
I: Integer;
begin
if Trim(ComboBoxHost.Text) = '' then Exit;
WinExec(PChar(Format('net send %s "%s"',
[ComboBoxHost.Text, ComboBoxNote.Text])), SW_HIDE);
I := ComboBoxHost.Items.IndexOf(ComboBoxHost.Text);
if I < 0 then
ComboBoxHost.Items.Add(ComboBoxHost.Text)
else ComboBoxHost.Items.Move(I, 0);
I := ComboBoxNote.Items.IndexOf(ComboBoxNote.Text);
if I < 0 then
ComboBoxNote.Items.Add(ComboBoxNote.Text)
else ComboBoxNote.Items.Move(I, 0);
end;
procedure TFormNetSendMessage.FormCreate(Sender: TObject);
begin
Application.Title := 'Net Send Message 1.0';
Caption := Application.Title;
if FileExists(ExePath + cFileNameHost) then
ComboBoxHost.Items.LoadFromFile(ExePath + cFileNameHost);
if FileExists(ExePath + cFileNameNote) then
ComboBoxNote.Items.LoadFromFile(ExePath + cFileNameNote);
ComboBoxHost.ItemIndex := 0;
ComboBoxNote.ItemIndex := 0;
end;