unit Main;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls,
Nb, ExtCtrls;
type
TForm1 = class(TForm)
Panel1: TPanel;
Memo1: TMemo;
Panel2: TPanel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
{---------------------------------------------}
{ enumerate the lana''s - works only on WIN32 }
{---------------------------------------------}
function NbLanaEnum: TLana_Enum;
var
NCB: TNCB;
L_Enum: TLana_Enum;
RetCode: Word;
begin
{$IFDEF WIN32}
FillChar(NCB, SizeOf(NCB), 0);
FillChar(L_Enum, SizeOf(TLana_Enum), 0);
NCB.Command := NCB_ENUM;
NCB.Buf := @L_Enum;
NCB.Length := Sizeof(L_Enum);
RetCode := NetBiosCmd(NCB);
if RetCode <> NRC_GOODRET then begin
L_Enum.Length := 0;
L_Enum.Lana[0] := Byte(RetCode);
end;
{$ELSE} { not supported for WIN16, fake LANA 0 }
L_Enum.Length := 1;
L_Enum.Lana[0] := 0;
{$ENDIF}
Result := L_Enum;
end;
{----------------------------------------}
{ Reset the lana - don''t for WIN16 ! }
{----------------------------------------}
function NbReset(l: Byte): Word;
var
NCB: TNCB;
begin
{$IFNDEF WIN32} { will reset all your connections for WIN1
6 }
Result := NRC_GOODRET; { so just fake a reset for Win16
}
{$ELSE}
FillChar(NCB, SizeOf(NCB), 0);
NCB.Command := NCB_RESET;
NCB.Lana_Num := l;
Result := NetBiosCmd(NCB);
{$ENDIF}
end;
{----------------------------------------}
{ return the MAC address of an interface }
{ in the form of a string like : }
{ ''xx:xx:xx:xx:xx:xx'' }
{ using the definitions in nb.pas }
{----------------------------------------}
function NbGetMacAddr(LanaNum: Integer): String;
var
NCB: TNCB;
AdpStat: TAdpStat;
RetCode: