-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexplorefrm.pas
52 lines (41 loc) · 994 Bytes
/
explorefrm.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
unit explorefrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls;
type
TExploreForm = class(TForm)
eStartIP: TLabeledEdit;
eEndIP: TLabeledEdit;
bScan: TButton;
lvHosts: TListView;
bAddSelected: TButton;
bClose: TButton;
pbScan: TProgressBar;
bSelectAll: TButton;
bStop: TButton;
procedure FormShow(Sender: TObject);
end;
var
ExploreForm: TExploreForm;
implementation
uses
WinSock;
{$R *.dfm}
procedure TExploreForm.FormShow(Sender: TObject);
var
ar:array[0..255] of char;
P:PHostEnt;
sa,ea:DWORD;
begin
if gethostname(@ar,SizeOf(ar)) = 0 then begin
P := gethostbyname(@ar);
if P <> NIL then begin
sa := PInteger(P.h_addr^)^ and $ffffff;
ea := sa or $fe000000;
eStartIP.Text := inet_ntoa(in_addr(sa));
eEndIP.Text := inet_ntoa(in_addr(ea));
end else RaiseLastOSError;
end else RaiseLastOSError;
end;
end.