unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,nb30;
type
TForm1 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
Var
NCB : TNCB;
ADAPTER : TADAPTERSTATUS;
LANAENUM : TLANAENUM;
intIdx : Integer;
re : Char;
buf : String;
begin
Try
ZeroMemory(@NCB, SizeOf(NCB));
NCB.ncb_command := Chr(NCBRESET);
NCB.ncb_lana_num := LANAENUM.lana[0];
re := NetBios(@NCB);
If Ord(re)<>0 Then
exit;
ZeroMemory(@NCB, SizeOf(NCB));
NCB.ncb_command := Chr(NCBASTAT);
NCB.ncb_lana_num := LANAENUM.lana[0];
StrPCopy(NCB.ncb_callname, '*');
NCB.ncb_buffer := @ADAPTER;
NCB.ncb_length := SizeOf(ADAPTER);
re := NetBios(@NCB);
If Ord(re)<>0 Then
exit;
buf := '';
For intIdx := 0 To 5 Do
buf := buf + InttoHex(Integer(ADAPTER.adapter_address[intIdx]),2)+'-';
edit1.Text := copy(buf,0,length(buf)-1);
Finally
End;
end;
end.