如题,还有在网络发消息代码,分不够可以再加

解决方案 »

  1.   

    要加我的MSN:[email protected]
      

  2.   

    UPUPUPUP
    UPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUP
      

  3.   

    我只发了,获取ip的聊天的正在美化 from ndjsyq3
      

  4.   

    索性给你粘上算了!
    unit Unit7;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, ImgList, ComCtrls, StdCtrls, Mask, Winsock, ExtCtrls;type
      TForm7 = class(TForm)
        ListView1: TListView;
        ImageList1: TImageList;
        GroupBox1: TGroupBox;
        Edit1: TEdit;
        Button2: TButton;
        MaskEdit1: TMaskEdit;
        GroupBox2: TGroupBox;
        Memo1: TMemo;
        Button1: TButton;
        Button3: TButton;
        StatusBar1: TStatusBar;
        edit: TButton;
        Button5: TButton;
        procedure Button2Click(Sender: TObject);
        procedure ListView1DblClick(Sender: TObject);
        procedure Button1Click(Sender: TObject);
        procedure Button3Click(Sender: TObject);
        procedure ListView1Click(Sender: TObject);
        procedure FormShow(Sender: TObject);
        procedure editClick(Sender: TObject);
        procedure Button5Click(Sender: TObject);
      private
        procedure SaveUser;
        procedure RestoreUser;
        function CheckValue(Name, Ip: string): string;
        procedure AddNewItem(Caption, data: string);
        procedure EditItem(AItem: TListItem; Caption, data: string);
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form7: TForm7;implementation
    uses csfuna;
    {$R *.dfm}function GetNameByIPAddr(IPAddr: string; var MacName: string): Boolean;
    var
      SockAddrIn: TSockAddrIn;
      HostEnt: PHostEnt;
      WSAData: TWSAData;
    begin
      Result := False;
      if IPAddr = '' then
        Exit;
      try
        WSAStartup(2, WSAData);
        SockAddrIn.sin_addr.s_addr := inet_addr(PChar(IPAddr));
        HostEnt := gethostbyaddr(@SockAddrIn.sin_addr.s_addr, 4, AF_INET);
        if HostEnt <> nil then
          MacName := StrPas(HostEnt^.h_name);
        Result := True;
      finally
        WSACleanup;
      end;
    end;function EmptyStr(StrList: Tstrings): Boolean;
    var
      i: integer;
    begin
      Result := False;
      for i := 0 to StrList.Count - 1 do
        if Trim(StrList[i]) = '' then
          Result := True;
    end;function TForm7.CheckValue(Name, Ip: string): string;
    var
      IpList: Tstrings;
      i: integer;
      mip: string;
    begin
      Result := '';
      if (Trim(Edit1.Text) = '') then
      begin
        ShowMessage('姓名未添全!');
        Exit;
      end;  IpList := TStringList.create;
      try
        IpList := splitstr(MaskEdit1.Text, '.');
        if EmptyStr(IpList) then
        begin
          ShowMessage('ip地址未添全!');
          Exit;
        end;    mip := '';
        for i := 0 to IpList.Count - 1 do
          if not isnum(Trim(IpList[i])) then
          begin
            ShowMessage('非法ip ,请检查');
            Exit;
          end
          else
            mip := mip + Trim(IpList[i]) + '.';    Result := Copy(mip, 1, Length(mip) - 1);
      finally
        FreeAndNil(IpList);
      end;end;procedure TForm7.AddNewItem(Caption, data: string);
    var
      AItem: TListItem;
      mstream: TMemoryStream;
    begin
      mstream := TMemoryStream.create;
      AItem := ListView1.Items.Add;
      AItem.Caption := Caption;
      strtostream(data, mstream);
      AItem.data := mstream;
    end;procedure TForm7.EditItem(AItem: TListItem; Caption, data: string);
    var
      mstream: TMemoryStream;
    begin
      mstream := TMemoryStream.create;
      AItem.Caption := Caption;
      strtostream(data, mstream);
      AItem.data := mstream;
    end;procedure TForm7.Button2Click(Sender: TObject);
    var  mip: string;
    begin
      mip := CheckValue(Edit1.Text, MaskEdit1.Text);
      if mip = '' then Exit;
      AddNewItem(Trim(Edit1.Text), mip);
    end;procedure TForm7.ListView1DblClick(Sender: TObject);
    begin  ShowMessage(ListView1.selected.Caption);
    end;procedure TForm7.Button1Click(Sender: TObject);
    var
      SelItem: TListItem;
      mip: string;
      MacName: string;
    begin  SelItem := ListView1.selected;
      if not (Assigned(SelItem)) then
        Exit;
      mip := streamtostr(TMemoryStream(SelItem.data));  GetNameByIPAddr(mip, MacName);  WinExec(PChar('net send ' + mip + ' ' + Memo1.Lines.Text), SW_HIDE);  if Trim(MacName) <> '' then
        showinformsg('已成功发送到: '+selitem.Caption)
      else
        ShowErrorMsg('发送失败!');end;procedure TForm7.SaveUser;
    var { TODO : 1 }
      IpList: Tstrings;
      i: integer;
    begin
      IpList := TStringList.create;
      try
        for i := 0 to ListView1.Items.Count - 1 do
          IpList.Add(ListView1.Items[i].Caption);    if not DirectoryExists(GetPath + 'bin') then
          ForceDirectories(GetPath + 'bin\');    IpList.SaveToFile(GetPath + 'bin\UserName.dat');    IpList.Clear;
        for i := 0 to ListView1.Items.Count - 1 do
          IpList.Add(streamtostr(TMemoryStream(ListView1.Items[i].data)));
        IpList.SaveToFile(GetPath + 'bin\UserIp.dat');  finally
        FreeAndNil(IpList);
      end;
    end;procedure TForm7.Button3Click(Sender: TObject);
    begin
      SaveUser;
      close;
    end;procedure TForm7.ListView1Click(Sender: TObject);
    var
      SelItem: TListItem;
    begin
      SelItem := ListView1.selected;
      if not (Assigned(SelItem)) then
        Exit;
      StatusBar1.SimpleText := '发送至:' + SelItem.Caption + '      ip:' +
        streamtostr(TMemoryStream(SelItem.data));
      Edit1.Text := SelItem.Caption;
      MaskEdit1.Text := streamtostr(TMemoryStream(SelItem.data));
      with Memo1.Lines do
      begin
        Clear;
        Add(SelItem.Caption + '你好:');
        Add('');
        Add('');
        Add('                                                              车双武');
        Add('                                                            ' +
          DateToStr(Now));
      end;
      Memo1.Lines[1] := '        ';
      Memo1.SetFocus;end;procedure TForm7.RestoreUser;
    var
      userlist, IpList: Tstrings;
      mstream: TMemoryStream;
      i: integer;
      // ThisItem : TListItem;
    begin
      userlist := TStringList.create;
      IpList := TStringList.create;  try
        if not FileExists(GetPath + 'bin\UserName.dat') or not FileExists(GetPath +
          'bin\Userip.dat') then
          Exit;
        userlist.LoadFromFile(GetPath + 'bin\UserName.dat');
        IpList.LoadFromFile(GetPath + 'bin\UserIp.dat');
        if userlist.Count <> IpList.Count then
        begin
          ShowErrorMsg('用户列表错误,请检查!');
          Exit;
        end;
        for i := 0 to userlist.Count - 1 do
        begin
          // ThisItem :=
          mstream := TMemoryStream.create;
          strtostream(IpList[i], mstream);
          ListView1.AddItem(userlist[i], mstream);
        end;
      finally
        FreeAndNil(userlist);
        FreeAndNil(IpList);
      end;
    end;procedure TForm7.FormShow(Sender: TObject);
    begin
      RestoreUser;
    end;procedure TForm7.editClick(Sender: TObject);
    var
      SelItem: TListItem;
      mip: string;
    begin
      SelItem := ListView1.selected;
      if not (Assigned(SelItem)) then
        Exit;
      mip := CheckValue(Edit1.Text, MaskEdit1.Text);
      if mip = '' then Exit;
      EditItem(SelItem, Trim(Edit1.Text), mip);
    end;procedure TForm7.Button5Click(Sender: TObject);
    begin
      if showquerymsg('确认删除吗?', True) = idyes then
        ListView1.DeleteSelected;
    end;end.
      

  5.   

    我的MSN [email protected]
    以后交流
      

  6.   

    to tsst
    能不能提供csfuna.duc