[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Delphi get in use mac address

Posted on 2011-10-13
4
Medium Priority
?
1,639 Views
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
0
Comment
Question by:kidd12
  • 2
4 Comments
 
LVL 19

Expert Comment

by:Thommy
ID: 36961067
Have you already tried this???

Get NIC MAC Address
http://www.prestwood.com/ASPSuite/KB/Document_View.asp?QID=100258
0
 
LVL 19

Accepted Solution

by:
Thommy earned 2000 total points
ID: 36961075
Another way to retrieve mac addresses of all interfaces...

http://www.delphipraxis.net/21219-mac-adresse-n-des-rechners-via-wmi-ermitteln.html
0
 
LVL 9

Expert Comment

by:rinfo
ID: 36967783
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;
var
  g: TGUID;
  i: Byte;
begin
  Result := '';
  CoCreateGUID(g);
  for i := 2 to 7 do
    Result := Result + IntToHex(g.D4[i], 2);
end;

Open in new window

0
 
LVL 13

Expert Comment

by:ThievingSix
ID: 36970160
@rinfo:

"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 (http://wiki.delphi-jedi.org/index.php?title=JEDI_Code_Library) 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.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

872 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