一个简单的UDP发送消息,判断它是否发送成功,怎么捕捉? 
  比如:
  
   Winexec(pchar('net send ' +IP+ ' ' +Memo1.Text),SW_HIDE); 
   if 发送成功 then  我该如何判断这个‘发送成功’、失败、或其他状态????

解决方案 »

  1.   

    Return ValuesIf the function succeeds, the return value is greater than 31.
    If the function fails, the return value is one of the following error values: Value Meaning
    0 The system is out of memory or resources.
    ERROR_BAD_FORMAT The .EXE file is invalid (non-Win32 .EXE or error in .EXE image).
    ERROR_FILE_NOT_FOUND The specified file was not found.
    ERROR_PATH_NOT_FOUND The specified path was not found.
      

  2.   

    if Winexec(pchar('net send ' +IP+ ' ' +Memo1.Text),SW_HIDE)>31 then
      showmessage('成功');
    else
      showmessage('失败');
      

  3.   

    procedure TFrSendMsg.BtnSendMsgClick(Sender: TObject);
    var i : Integer;
    begin
      i := Winexec(pchar('net send ' +'192.168.0.100' + ' ' +Memo1.Text),SW_HIDE);
      if (i>31) then
        ShowMessage('Succesful!')
      else
        ShowMessage('May be get some error!');
    end;每次信息提示都为:Succesful!
    继续up
      

  4.   

    '192.168.0.100' ,我把该内容改为不可能的计算机名:dddddddddddd,每次信息提示都为:Succesful!UDP的发送消息也应该有检测吧?
      

  5.   

    呵呵,那不是winexec能判断的,winexec只是调用了net send
    你想要的返回值是net send(netmessagebuffersend)的返回值,是发送成功与否
      

  6.   

    楼上的朋友,是不是能告诉如何判断?net send(netmessagebuffersend)的返回值