?? local.pas
字號:
unit local;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,Winsock;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Memo1: TMemo;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
function FindComputer(ComputerName: string):Boolean;
implementation
{$R *.DFM}
function FindComputer(ComputerName: string):Boolean;
var
WSAData: TWSAData;
HostEnt: PHostEnt;
begin
Result :=True;
WSAStartup(2, WSAData);
HostEnt := gethostbyname(PChar(ComputerName));
if HostEnt = nil then Result := False;
WSACleanup;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if FindComputer(edit1.text)=True then
Memo1.lines.Add(edit1.text+'在局域網上!')
else
Memo1.lines.Add(edit1.text+'不在局域網上!');
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -