本帖最后由 zplovepkk 于 2010-07-01 05:27:35 编辑

解决方案 »

  1.   

    Databuf指针没分配内存,lpNumberOfBytesSent应该传入指针var
    s:TSocket;    //套接字,我已经处理了,临时定义在这里,为大家能看清,程序里是全局变量,并已经连接
    Databuf:TWSABUF;
    buf:pchar;
    lpNumberOfBytesSent:DWORD;
    begin
    buf:='1234567890';
    Databuf.len:=Length(Buf);
    Databuf.buf:=Buf;
    WSASend(SendHook,@Databuf,1,@lpNumberOfBytesSent,0,nil, nil);
    end;
      

  2.   

    LPWSABUF的定义是一个指针,你有申请内存吗?  
    WSABUF = packed record
        len: U_LONG;  { the length of the buffer }
        buf: PChar; { the pointer to the buffer }
      end {WSABUF};
      PWSABUF = ^WSABUF;
      LPWSABUF = PWSABUF;