Link to home
Start Free TrialLog in
Avatar of Member_2_99151
Member_2_99151

asked on

How Can I Get the MAC Address Of A Network Card ?

Hi,

Is there a simple way to find out the MAC address of a network card for a Windows program ?

Thanks,

James
Avatar of Member_2_99151
Member_2_99151

ASKER

Maybe there is an ActiveX control which will supply such info ?
nbtstat -a name-of-machine
1) Windows-specific questions should be asked in the windows programming area.
2a) CoCreateGuid()
2b) UuidCreate()


Last bytes of the pointed to value are the MAC address (if there is a NIC, that is...)
Sorry, I should have made the question a bit clearer ...

What I am looking for is a function that I can call from within a C program that will return such info.

An ActiveX control would be even easier ... if one existed ?

Thanks again
oops, missed that we're in C topic, sorry.
So if all fails, you may use somthing like (just out of memory:)

popen(pipe "nbtstat -a name-of-machine|");
while (fscanf(pipe,"%s")!=eof) {
  /* parse input */
}
close(pipe);
ASKER CERTIFIED SOLUTION
Avatar of alexo
alexo
Flag of Antarctica image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That works great !  Thanks !

Is there is an alternative library in Borland C ?
>> Is there is an alternative library in Borland C ?

Huh?
The libraries 'rpcrt4.lib' and 'ole32.lib' appear to be part of Visual C++. This isn't a problem as we can compile as a separate DLL, however, it would be nice to include this into our standard Security Libraries (which are compiled using Borland C)

I tried using the libraries supplied with Visual C in Borland C, but it is having none of it !

I thaught there may be 'equivalent' libraries in BC ?

This is somewhat of a new area to me, so please excuse me if I'm missing something simple !!!

Thanks again,

James
Those libraries implement the functions CoCreateGuid() and UuidCreate().
I don't know what is the Borland counterpart.

Found it !
Borland C contains a library called 'ole2w32.lib'
The function is in there.

Thanks for all the help,

James