Есть вот такой исходник,все нормально компилируется,но ни чего не отображает
| Код | unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls;
type TForm1 = class(TForm) Button1: TButton; Label1: TLabel; Label2: TLabel; Label3: TLabel; Timer1: TTimer; procedure Button1Click(Sender: TObject); procedure Timer1Timer(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1; FlibHandle: THandle; dwInOctets :DWORD; dwOutOctets :DWORD; dwPhysAddrLen: DWORD; bDescr : array[0..255] of Char; bPhysAddr : array[0..7] of Byte; GetIfTable: pointer;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject); begin Timer1.Enabled:=True; end;
procedure TForm1.Timer1Timer(Sender: TObject); type TMAC = array [0..7] of Byte; function GetMAC(Value: TMAC; Length: DWORD): String; var i: Integer; begin if Length = 0 then Result := '00-00-00-00-00-00' else begin Result := ''; for i:= 0 to Length -2 do Result := Result + IntToHex(Value[i],2)+'-'; Result := Result + IntToHex(Value[Length-1],2); end; end; begin FLibHandle := LoadLibrary('IPHLPAPI.DLL'); GetIfTable:=GetProcAddress(FLibHandle, 'GetIfTable'); Label1.Caption:='Входящий трафик: '+IntToStr(dwInOctets); Label2.Caption:='Исходящий трафик: '+IntToStr(dwOutOctets); Label3.Caption:='МАС-адрес: '+(GetMAC(TMAC(bPhysAddr),dwPhysAddrLen)); FreeLibrary(FLibHandle); end; end.
|
! THandle | Модератор: Используйте подсветку кода!!! |
|