各位!
    想必大家都用过net send ,就是强行发送消息。
    如果知道!最好给点代码!
                谢了!

解决方案 »

  1.   

    为什么开两个贴?我再来拿分:)winexec('../../net.exe send .......',SW_NORMAL);
    给分呀:)
      

  2.   

    这种代码,到处都有。使用Api函数NetMessageBufferSend,代码如下:
    unit MainUnit;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, Buttons, ExtCtrls;type
      TMainForm = class(TForm)
        Panel1: TPanel;
        Panel2: TPanel;
        StatusLabel: TPanel;
        Panel4: TPanel;
        Label1: TLabel;
        AdrComboBox: TComboBox;
        Panel5: TPanel;
        MsgText: TMemo;
        SendBitBtn: TBitBtn;
        AboutBitBtn: TBitBtn;
        ExitBitBtn: TBitBtn;
        procedure SendBitBtnClick(Sender: TObject);
      private
        { Private declarations }
      public
        function SendMsg(Toh, From, Msg: string): Integer;
        { Public declarations }
      end;
      
      function NetMessageBufferSend(Servername, MsgName, FromName, Buf: PWideChar;
        var BufLen: Integer): Integer;stdcall;var
      MainForm: TMainForm;implementation{$R *.dfm}function NetMessageBufferSend; external 'netapi32.dll' name 'NetMessageBufferSend';function TMainForm.SendMsg(Toh,From,Msg: string): integer;
    var
      ToName: array [0..64] of WideChar;
      FromName: array [0..64] of WideChar;
      WMsgText: array [0..1000] of WideChar;
      MsgLen, i: Integer;
    begin
      for i := 0 to 64 do
      begin
        ToName[i] :=#0;
        FromName[i] := #0;
      end;
    StringToWideChar(Toh, ToName, MsgLen);
    StringToWideChar(From, FromName, MsgLen);
      for i := 0 to 1000 do WMsgText[i] := #0;
    StringToWideChar(Msg, WMsgText, MsgLen);
      Result := NetMessageBufferSend(nil, ToName, nil, WMsgText, MsgLen);
    end;procedure TMainForm.SendBitBtnClick(Sender: TObject);
    var
      res : integer;
    begin
      if AdrComboBox.Text <> '' then
      begin
        StatusLabel.Caption := 'Wait...';
        Update;
        if AdrComboBox.Items.IndexOf(AdrComboBox.Text) = -1 then
        begin
          if AdrComboBox.Items.Count > 20 then
            AdrComboBox.Items.Delete(0);
          AdrComboBox.Items.Add(AdrComboBox.Text);
        end;
        res := SendMsg(AdrComboBox.Text, '', MsgText.Text);
        case res of
          0 : StatusLabel.Caption := 'The message is sent';
          87 : StatusLabel.Caption := 'The parameter is incorrect';
          123 : StatusLabel.Caption := 'sintax is incorrect';
          2273 : StatusLabel.Caption := 'Can not find'+ AdrComboBox.Text;
        else
          StatusLabel.Caption := 'Error: '+IntToStr(res);
        end;
      end;
    end;end.
      

  3.   

    use ShellAPiShell('net send ' + HostName + 'SendInfo');
      

  4.   

    http://www.playicq.com/dispdoc.php?t=27&id=89看来是烂贴了!接不了了!
      

  5.   

    net send 192.168.0.255 <message>