source: trunk/Packages/synapse/source/demo/snmp/Unit1.pas

Last change on this file was 2, checked in by chronos, 12 years ago
  • Přidáno: Základní kostra projektu.
  • Přidáno: Knihovna synapse.
File size: 1.3 KB
Line 
1unit Unit1;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 SNMPsend, StdCtrls;
8
9type
10 TForm1 = class(TForm)
11 Edit1: TEdit;
12 Label1: TLabel;
13 Button1: TButton;
14 Label2: TLabel;
15 Label3: TLabel;
16 Edit2: TEdit;
17 Label4: TLabel;
18 Edit3: TEdit;
19 Memo1: TMemo;
20 Memo2: TMemo;
21 Label5: TLabel;
22 Label6: TLabel;
23 procedure Button1Click(Sender: TObject);
24 private
25 { Private declarations }
26 public
27 { Public declarations }
28 end;
29
30var
31 Form1: TForm1;
32
33implementation
34
35{$R *.DFM}
36
37procedure TForm1.Button1Click(Sender: TObject);
38var
39 response,s:string;
40 n:integer;
41begin
42 if SNMPget(Edit3.Text,Edit2.Text,Edit1.Text,response)
43 then
44 begin
45 label2.Caption:='Success...';
46 memo1.Lines.Clear;
47 memo2.Lines.Clear;
48 memo1.Lines.Text:=response;
49 s:='';
50 for n:=0 to Length(response) do
51 begin
52 s:=s+'$'+IntToHex(Ord(response[n]),2)+' ';
53 end;
54 memo2.Lines.Text:=s;
55 end
56 else
57 begin
58 label2.Caption:='Not contacted... (Check SNMP host, community or MIB OID!)';
59 memo1.Lines.Clear;
60 memo2.Lines.Clear;
61 end;
62end;
63
64end.
65
Note: See TracBrowser for help on using the repository browser.