Following is the Code that worked for me:
Global Variable:
char MACAddressStr[20] = "";
GetMACAddress() Function:
char GetMACAddress(void) {
char part[4];
unsigned int i;
IP_ADAPTER_INFO AdapterInfo[16];
DWORD dwBufLen = sizeof(AdapterInfo);
DWORD dwStatus = GetAdaptersInfo(AdapterInfo, &dwBufLen);
assert(dwStatus == ERROR_SUCCESS);
PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;
do{
for(i = 0;i < (pAdapterInfo->AddressLength); i++) {
sprintf_s(part, "%02x-", pAdapterInfo->Address[i]);
strcat_s(MACAddressStr, part);
};
MACAddressStr[strlen(MACAddressStr)-1] = 0;
pAdapterInfo = pAdapterInfo->Next;
}while(pAdapterInfo);
return MACAddressStr[20];
}
And call the following either in a switch or after a call to CreateWindow/Ex() in WinMain or in a separate function:
GetMACAddress();
char *pMACAddressStr[sizeof(MACAddressStr)];
for(int i = 0; i < sizeof(MACAddressStr); i++) {
pMACAddressStr[i] = &MACAddressStr[i];
}
SendMessageA(hwndLabel, WM_SETTEXT, 0, (int)pMACAddressStr[0]);
Thanks '<<_Superman_>>' and 'Thaddeus Jones' for the help!
Much Appreciated :)