Delphi get in use mac address

Posted on 2011-10-13
Last Modified: 2012-05-12
hello friends i am picked various commands for pick mac address in delphi and not picked one good, i am need pick the active network mac address, in my pc i am have virtualbox and more than one mac address and when i run program in delphi pick another mac address not pick the mac i am using.
Please help me
Question by:kidd12
    LVL 19

    Expert Comment

    Have you already tried this???

    Get NIC MAC Address
    LVL 19

    Accepted Solution

    Another way to retrieve mac addresses of all interfaces...
    LVL 9

    Expert Comment

    First simplest way to get MAC address is using windows API from Ole32.dll.
    This will get you the first MAC address in case of multiple mac addresses(fro multiple cards).

    function CoCreateGuid(var guid: TGUID): HResult; stdcall; far external 'ole32.dll';
    function Get_MACAddress: string;
      g: TGUID;
      i: Byte;
      Result := '';
      for i := 2 to 7 do
        Result := Result + IntToHex(g.D4[i], 2);

    Open in new window

    LVL 13

    Expert Comment


    "The CoCreateGuid function calls the RPC function UuidCreate"
    "For security reasons, UuidCreate was modified so that it no longer uses a machine's MAC address to generate UUIDs."

    The simplest solution if you already have JCL ( installed is to use GetMacAddresses() found in JclSysInfo.pas.

    The reason I prefer this method is because it incorporates the other methods shown here as well as a few others just in case on method fails.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
    Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now