Проверить, доступен ли WinSock
Оформил: DeeCo
Автор: http://www.swissdelphicenter.ch
uses
Winsock;
function WinsockEnabled: Boolean;
var
wsaData: TWSAData;
begin
Result := True;
case Winsock.WSAStartup($0101, wsaData) of
WSAEINVAL, WSASYSNOTREADY, WSAVERNOTSUPPORTED: Result := False;
else
Winsock.WSACleanup;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if WinsockEnabled then
ShowMessage('Winsock is enabled')
else
ShowMessage('Winsock is disabled');
end;
|