Page 1 of 3
mac address
Posted: Tue Oct 11, 2005 2:52 am
by NageswaraRao, G.
Can any please help me how to find mac address of the PC ?
Thanks in advance
NageswaraRao
Posted: Tue Oct 11, 2005 7:54 am
by Antonio Linares
You may use GETNETCARDID()
mac address
Posted: Tue Oct 11, 2005 9:42 pm
by NageswaraRao, G.
Thanks Mr. Antonio.
But I am getting unlinked external "GetAdapetersInfo" referenced by function "NETCRDID"
I am using xHarbour with FWH.
Can you help me with this please?
Regards
Nageswararao
Posted: Tue Oct 11, 2005 10:28 pm
by Antonio Linares
NageswaraRao,
Are you using xHarbour commercial ?
GetNetCardID
Posted: Wed Oct 12, 2005 6:01 am
by srrao
Add IPHLPAPI.LIB from bcc55 into your script if your are using bcc
mac address
Posted: Wed Oct 12, 2005 6:51 am
by NageswaraRao, G.
I am using xharbour with bcc55. not the commercial version. i included the lib iphlpapi.lib as advised by srrao and now its working fine. thanks mr. antonio and mr. sanjay
Posted: Wed Oct 12, 2005 7:34 am
by Antonio Linares
NageswaraRao,
Yes, right, that library is needed. We already provided it included in samples\buildh.bat. I guess you are using an older version of buildh.bat.
GetNetCardID under xhb Commercial
Posted: Thu Jun 07, 2007 7:18 am
by AlexSchaft
Hi,
I'm getting a unresolved external __chkstk when I try to use this
Posted: Thu Jun 07, 2007 7:21 am
by Antonio Linares
Alex,
Try linking Borland cw32.lib
Posted: Thu Jun 07, 2007 7:25 am
by AlexSchaft
A borland library with commercial xharbour?
Posted: Thu Jun 07, 2007 7:31 am
by Antonio Linares
ops, my mistake
Then you should require it to xHB guys.
If I am not wrong, __chkstk stands for check stack, so you could safely create a dummy C function with such name
void _chkstk( void ) { }
GetNetCardID
Posted: Thu Jun 07, 2007 7:39 am
by AlexSchaft
If I add that dummy function, GetNetCardID kills my app.
Will ask on xhb newsgroup
Alex
Posted: Thu Jun 07, 2007 8:19 am
by Antonio Linares
Alex,
> Will ask on xhb newsgroup
Yes, its the right way
Posted: Thu Jun 07, 2007 8:32 am
by Antonio Linares
Alex,
Just out of curiosity, please try it this way:
BOOL _chkstk( void ) { return TRUE; }
Posted: Thu Jun 07, 2007 9:06 am
by AlexSchaft
No luck
Busy trying to get following code to work. It compiles. I just need to figure out how to return an array of adapter names and addresses
Code: Select all
#include <iphlpapi.h>
// Fetches the MAC address and prints it
static void GetMACaddress(void)
{
IP_ADAPTER_INFO AdapterInfo[16]; // Allocate information
// for up to 16 NICs
DWORD dwBufLen = sizeof(AdapterInfo); // Save memory size of buffer
DWORD dwStatus = GetAdaptersInfo( // Call GetAdapterInfo
AdapterInfo, // [out] buffer to receive data
&dwBufLen); // [in] size of receive data buffer
// assert(dwStatus == ERROR_SUCCESS); // Verify return value is
// valid, no buffer overflow
PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo; // Contains pointer to
// current adapter info
do {
// PrintMACaddress(pAdapterInfo->Address); // Print MAC address
pAdapterInfo = pAdapterInfo->Next; // Progress through
// linked list
}
while(pAdapterInfo); // Terminate if last adapter
}