把下面的VC代码直接翻译为DELPHI语法的!谢谢!只要照着翻译就行!if(WSCEnumProtocols(NULL,protoinfo,&protoinfosize,&errorcode)==SOCKET_ERROR)
{
if(errorcode!=WSAENOBUFS)
{
OutputDebugString(_T("First WSCEnumProtocols Error!"));
return FALSE;
}
} if((protoinfo=(LPWSAPROTOCOL_INFOW)GlobalAlloc(GPTR,protoinfosize))==NULL)
{
OutputDebugString(_T("GlobalAlloc Error!"));
return FALSE;
} if((totalprotos=WSCEnumProtocols(NULL,protoinfo,&protoinfosize,&errorcode))==SOCKET_ERROR)
{
OutputDebugString(_T("Second WSCEnumProtocols Error!"));
return FALSE;
} return TRUE;
}
{
if(errorcode!=WSAENOBUFS)
{
OutputDebugString(_T("First WSCEnumProtocols Error!"));
return FALSE;
}
} if((protoinfo=(LPWSAPROTOCOL_INFOW)GlobalAlloc(GPTR,protoinfosize))==NULL)
{
OutputDebugString(_T("GlobalAlloc Error!"));
return FALSE;
} if((totalprotos=WSCEnumProtocols(NULL,protoinfo,&protoinfosize,&errorcode))==SOCKET_ERROR)
{
OutputDebugString(_T("Second WSCEnumProtocols Error!"));
return FALSE;
} return TRUE;
}
if errorcode<>WSAENOBUFS then
begin
OutputDebugString('First WSCEnumProtocols Error!');
return FALSE;
end; protoinfo1 : pointer;
protoinfo : ^WSAPROTOCOL_INFOW;
if (protoinfo1:=GlobalAlloc(GPTR,protoinfosize))=NULL then
begin
OutputDebugString(_T("GlobalAlloc Error!"));
return FALSE;
end; protoinfo:=protoinfo1;
if (totalprotos:=WSCEnumProtocols(NULL,protoinfo,@protoinfosize,@errorcode))=SOCKET_ERROR then
begin
OutputDebugString('Second WSCEnumProtocols Error!');
return FALSE;
end; return TRUE;未试,不知指针换得过来没有