mac address

NageswaraRao, G.
Posts: 3
Joined: Tue Oct 11, 2005 2:10 am
Location: India
Contact:

mac address

Post by NageswaraRao, G. »

Can any please help me how to find mac address of the PC ?
Thanks in advance

NageswaraRao
NageswaraRao, G.
India
email: nagesh_g@yahoo.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

You may use GETNETCARDID()
regards, saludos

Antonio Linares
www.fivetechsoft.com
NageswaraRao, G.
Posts: 3
Joined: Tue Oct 11, 2005 2:10 am
Location: India
Contact:

mac address

Post 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
NageswaraRao, G.
India
email: nagesh_g@yahoo.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

NageswaraRao,

Are you using xHarbour commercial ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
srrao
Posts: 10
Joined: Sat Oct 08, 2005 4:24 am
Location: The Nilgiris, South India

GetNetCardID

Post by srrao »

Add IPHLPAPI.LIB from bcc55 into your script if your are using bcc
NageswaraRao, G.
Posts: 3
Joined: Tue Oct 11, 2005 2:10 am
Location: India
Contact:

mac address

Post 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
NageswaraRao, G.
India
email: nagesh_g@yahoo.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
AlexSchaft
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

GetNetCardID under xhb Commercial

Post by AlexSchaft »

Hi,

I'm getting a unresolved external __chkstk when I try to use this
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Alex,

Try linking Borland cw32.lib
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
AlexSchaft
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

Post by AlexSchaft »

A borland library with commercial xharbour?
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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 ) { }
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
AlexSchaft
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

GetNetCardID

Post by AlexSchaft »

If I add that dummy function, GetNetCardID kills my app.

Will ask on xhb newsgroup

Alex
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Alex,

> Will ask on xhb newsgroup

Yes, its the right way :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Alex,

Just out of curiosity, please try it this way:

BOOL _chkstk( void ) { return TRUE; }
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
AlexSchaft
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

Post 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
}
Post Reply