Follow along with the video below to see how to install our site as a web app on your home screen.
ملاحظة: This feature may not be available in some browsers.
ياريت اخي محتاجه ضرورياخي لو عايز سورس كود لبرنامج يعمل هذي الأشياء انا حاظر
اخي الفاضل
انصحك ان تتعلم من البداية ادا كنت حابب تتعلم هده اللغة
تدكر الصبر مفتاح الفرج
يعني بدك تصبر حتى تتعلم
شاهد هده الدورة راح تفيدك
منتديات صقور الابداع دورة تعلم لغة الدلفي, دورة تعليميه تحتوي 21 درس للتعامل مع الدلفي من الصفر
وهناك ايضا بالقسم مجموعة من الدورات والكتب ودورات بالصوت والصورة
اختار الي يعجبك
تعلم اساسيات الدلفي ومن تم تعال اسئل كيف اسوي واعمل
البناية لا يمكن لها ان تقوم الا بالاساسات
بالتوفيق
uses nb30;
type
TMACAddress = packed array[0..5] of Byte;
TAStat = record
Adapt: TAdapterStatus;
NameBuff: array[0..30] of TNameBuffer;
end;
function GetMacAddress(AdapterNum: Integer): TMACAddress;
var
Ncb: TNCB;
uRetCode: Char;
j: Integer;
Adapter: TAStat;
begin
FillChar(NCB, SizeOf(NCB), 0);
with NCB do
begin
ncb_command := Char(NCBRESET);
ncb_lana_num := Char(AdapterNum);
end;
uRetCode := NetBios(@Ncb);
if uRetCode <> #0 then
raise Exception.CreateFmt('NetBIOS error code = %f', [Ord(uRetCode)]);
FillChar(NCB, SizeOf(NCB), 0);
with NCB do
begin
ncb_command := Char(NCBASTAT);
ncb_lana_num := Char(AdapterNum);
StrCopy(ncb_callname, '* ');
ncb_buffer := @Adapter;
ncb_length := SizeOf(Adapter);
end;
uRetCode := NetBios(@Ncb);
if uRetCode <> #0 then
raise Exception.CreateFmt('NetBIOS error code = %f', [Ord(uRetCode)]);
for j := 0 to 5 do
Result[j] := Ord(Adapter.Adapt.Adapter_address[j]);
end;
function LanAdapterCount: Integer;
var
Ncb: TNCB;
uRetCode: Char;
lEnum: TLanaEnum;
begin
FillChar(NCB, SizeOf(NCB), 0);
with NCB do
begin
ncb_command := Char(NCBENUM);
ncb_buffer := @lEnum;
ncb_length := SizeOf(lEnum);
end;
uRetCode := Netbios(@Ncb);
if uRetCode <> #0 then
raise Exception.CreateFmt('NetBIOS error code = %f', [Ord(uRetCode)] );
Result := Ord(lenum.length);
end;
Sample of use:
var
MAC: TMACAddress;
i: Integer;
s: string;
begin
MAC := GetMacAddress(LanAdapterCount());
s := '';
for i := 0 to 5 do
s := s + IntToHex(MAC[i], 2) + ' ';
ShowMessage(s)
end;
function CoCreateGuid(var guid: TGUID): HResult; stdcall; far external 'ole32.dll';
function Get_MACAddress: string;
var
g: TGUID;
i: Byte;
begin
Result := '';
CoCreateGUID(g);
for i := 2 to 7 do
Result := Result + IntToHex(g.D4[i], 2);
end;
function GetAdapterInfo(Lana: Char): String;
var
Adapter: TAdapterStatus;
NCB: TNCB;
begin
FillChar(NCB, SizeOf(NCB), 0);
NCB.ncb_command := Char(NCBRESET);
NCB.ncb_lana_num := Lana;
if Netbios(@NCB) <> Char(NRC_GOODRET) then
begin
Result := 'mac not found';
Exit;
end;
FillChar(NCB, SizeOf(NCB), 0);
NCB.ncb_command := Char(NCBASTAT);
NCB.ncb_lana_num := Lana;
NCB.ncb_callname := '*';
FillChar(Adapter, SizeOf(Adapter), 0);
NCB.ncb_buffer := @Adapter;
NCB.ncb_length := SizeOf(Adapter);
if Netbios(@NCB) <> Char(NRC_GOODRET) then
begin
Result := 'mac not found';
Exit;
end;
Result :=
IntToHex(Byte(Adapter.adapter_address[0]), 2) + '-' +
IntToHex(Byte(Adapter.adapter_address[1]), 2) + '-' +
IntToHex(Byte(Adapter.adapter_address[2]), 2) + '-' +
IntToHex(Byte(Adapter.adapter_address[3]), 2) + '-' +
IntToHex(Byte(Adapter.adapter_address[4]), 2) + '-' +
IntToHex(Byte(Adapter.adapter_address[5]), 2);
end;
function GetMACAddress: string;
var
AdapterList: TLanaEnum;
NCB: TNCB;
begin
FillChar(NCB, SizeOf(NCB), 0);
NCB.ncb_command := Char(NCBENUM);
NCB.ncb_buffer := @AdapterList;
NCB.ncb_length := SizeOf(AdapterList);
Netbios(@NCB);
if Byte(AdapterList.length) > 0 then
Result := GetAdapterInfo(AdapterList.lana[0])
else
Result := 'mac not found';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Text:=(GetMACAddress);
end;