Board index » delphi » need to grab card MAC address
Charles Walter
![]() Delphi Developer |
Wed, 09 Nov 2005 08:53:30 GMT
|
Charles Walter
![]() Delphi Developer |
Wed, 09 Nov 2005 08:53:30 GMT
need to grab card MAC address
It may be already in one of my tools, but, doggone it, it may not... is
there a way in Delphi to Get_MAC_address, the eight byte string that is hard coded in the ethernet card? If it is too obvious, I will be embarrassed, but I will also have it, and can move on to other more wonderous things. Thanks! |
Grahame Griev
![]() Delphi Developer |
Wed, 09 Nov 2005 09:25:52 GMT
Re:need to grab card MAC addressQuoteCharles Walter wrote: you can get it from netbios. Sometimes. one issue is that if you have multiple cards, the most reliable way to get it is to run Grahame |
Charles Walte
![]() Delphi Developer |
Wed, 09 Nov 2005 11:18:15 GMT
Re:need to grab card MAC addressThanks for your response, but I have seen applications that report the MAC address, while the user is doing some sort of configuration job. In fact, ipconfig is a <utility> application. If there is more than one card, I would read them all, like ipconfig would. Maybe I need to do something at a lower level... like importing a (possibly Delphi-unsupported) winAPI function and then calling it. Any suggestion here? The MAC address should be readable within Delphi some way... maybe you have to send an inquiry to a daemon sitting at a TCP port, I am only guessing. I would hate to re-invent an already known wheel. Charles Quote> it rurns out to be rather hard to get. |
Kelly Leah
![]() Delphi Developer |
Wed, 09 Nov 2005 13:31:41 GMT
Re:need to grab card MAC addressLook up the GetAdaptersInfo function. Not supported on all OSes. Kelly Quote"Charles Walter" <char...@litek.com> wrote in message Quote> Thanks for your response, but I have seen applications that report the |
Kelly Leah
![]() Delphi Developer |
Wed, 09 Nov 2005 13:33:21 GMT
Re:need to grab card MAC addressOh... GetIfEntry is supported on more OSes (NT 4.0 included). Kelly Quote"Charles Walter" <char...@litek.com> wrote in message Quote> Thanks for your response, but I have seen applications that report the |
Bob Smit
![]() Delphi Developer |
Thu, 10 Nov 2005 05:39:18 GMT
Re:need to grab card MAC addressHello Charles, This is from Torry's Delphi pages under tips and tricks. Good Luck uses NB30; function GetMACAdress: string; URetCode: PChar; Getmem(Lenum, SizeOf(TLanaEnum)); Getmem(Adapter, SizeOf(TAdapterStatus)); Lenum.Length := chr(0); i := 0; Fillchar(NCB^, SizeOf(TNCB), 0); Ncb.ncb_buffer := Pointer(Adapter); Ncb.ncb_length := SizeOf(TAdapterStatus); procedure TForm1.Button1Click(Sender: TObject); Quote"Charles Walter" <char...@litek.com> wrote in message Quote> It may be already in one of my tools, but, doggone it, it may not... is |
Charles Walte
![]() Delphi Developer |
Fri, 11 Nov 2005 10:39:03 GMT
Re:need to grab card MAC addressBob, I dropped your code in place, and..... IT WORKS ! Oh, thank you thank you, news groups rock. I will pop up somewhere to help another, you'll see. Charles |
Grahame Griev
![]() Delphi Developer |
Fri, 11 Nov 2005 12:12:48 GMT
Re:need to grab card MAC addressQuoteCharles Walter wrote: always work - depends how the PC is set up. The getIfEntry/getAdaptorsInfo approach is more Grahame |
Andrey Koto
![]() Delphi Developer |
Fri, 11 Nov 2005 14:41:11 GMT
Re:need to grab card MAC addressQuote"Grahame Grieve" <grah...@kestral.com.au> wrote in message Quote> warning: this is the netbios call, and it doesn't (ftp://delphi-jedi.org/api/snmp.zip) procedure GetMACAddresses(List: TStrings); MIB_ifMACEntAddr.idLength := Length(OID_ipMACEntAddr); if not SnmpExtensionInit(GetTickCount, PollForTrapEvent, SupportedView) // Initialize the variable list to be retrieved by m_Query // Copy in the OID to find the number of entries in the Inteface table Ret := SnmpExtensionQuery(SNMP_PDU_GETNEXT, varBindList, ErrorStatus, List.Add(Format('Number of adapters: %d', [varBind[0].value.number])); varBindList.len := 2; // Copy in the OID of ifType, the type of interface // Copy in the OID of ifPhysAddress, the address I := 0; UnloadSnmpExtension; SnmpUtilVarBindFree(@varBind[0]); |
Charles Walte
![]() Delphi Developer |
Sun, 20 Nov 2005 06:06:31 GMT
Re:need to grab card MAC addressI tried both suggestions submitted here, and they both work on "MY" machine. I am gratefull for you guys' feadback. |
1. How to get the network card MAC address?
3. Getting the MAC Address of a network card in Delphi 1
4. About the MAC address of ethernet cards
5. How to Read the MAC Address of NIC Card
6. How Can I read the MAC address from the LAN card
7. MAC Address for Primary NIC card
8. Read IP-Address and MAC-Address from Netcard