[ sale83 @ 12.03.2006. 09:40 ] @
Da li je neko mozda radio nesto u C++ Bulider 6 oko Mac Adrese - Physical Address ?

Kako mogu u C++ Bulider 6 da nadjem Mac adresu ???
Pokusao sam na goolge ali slabo!!

Recimo kad kliknem na dugme da mi pokaze MAC adresu !!

Imam program uradjen u VB.NET-u ali mi sad treba u C++ !!
Bilo kakva pomoc link do nekog koda koji je radjen u C++ Bulider 6 doveo ce doci!!

Znaci ne treba mi konzolno resenje !! To imam i ima gomila toga na netu!

Pozzz
[ X Files @ 12.03.2006. 11:21 ] @
Pogledaj ovde:
http://bdn.borland.com/article/0,1410,26040,00.html

(i obrati paznju da moze bit i vise MAC adresa)

[ sale83 @ 12.03.2006. 13:13 ] @
Geldao sam taj link pre nego sto sam otvorio temu!!

Pokusao sam da prevedem kod sa Dev C++ 5 i sa C++ Bulider 6 i nisam uspeo!!

Code:

#include <windows.h>
#include <iostream>
#include <conio.h>

using namespace std;

int main()
{
    cout << "MAC address is: ";

    // Ask COM to create a UUID for us.  If this machine has an Ethernet
    // adapter, the last six bytes of the UUID (bytes 2-7 inclusive in
    // the Data4 element) should be the MAC address of the local
    // Ethernet adapter.
    GUID uuid;
    CoCreateGuid(&uuid);
    // Spit the address out
    char mac_addr[18];
    sprintf(mac_addr,"%02X:%02X:%02X:%02X:%02X:%02X",
            uuid.Data4[2],uuid.Data4[3],uuid.Data4[4],
            uuid.Data4[5],uuid.Data4[6],uuid.Data4[7]);
    cout << mac_addr << endl;
    getch();
    return 0;
}



Greska: Undefined Reference to CoCreateGuid !! - Dev C++

C++ Bulider 6

[Linker Error] Unresolved external '__InitVCL' referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\LIB\CP32MTI.LIB|crtlvcl
[Linker Error] Unresolved external '__ExitVCL' referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\LIB\CP32MTI.LIB|crtlvcl

Takodje i druga dva primera ne funkcionisu !!

[ X Files @ 12.03.2006. 13:40 ] @
Probaj da dodas:

#include <vcl.h>

ili probaj:

AnsiString GetNicInfo()
{
IP_ADAPTER_INFO AdapterInfo[16];
AnsiString retv=""; unsigned int ii;
DWORD dwBufLen,dwStatus;
dwBufLen=sizeof(AdapterInfo);
dwStatus=GetAdaptersInfo(AdapterInfo,&dwBufLen);
if (dwStatus!=ERROR_SUCCESS) return "**Could not Obtain NIC Info";
PIP_ADAPTER_INFO pAdapterInfo=AdapterInfo;
do
{
retv+="Name :"+AnsiString(pAdapterInfo->AdapterName)+
"\r\nDescription :"+AnsiString(pAdapterInfo->Description)+"\r\nMAC:";
for (ii=0;ii<pAdapterInfo->AddressLength;++ii)
retv+=IntToHex(pAdapterInfo->Address[ii],2)+" ";
retv+="\r\n"; pAdapterInfo=pAdapterInfo->Next;
}
while (pAdapterInfo);
return retv;

}

[Ovu poruku je menjao X Files dana 12.03.2006. u 15:03 GMT+1]
[ leka @ 27.03.2006. 13:22 ] @
Ako koristis Dev-C++, onda treba da ubacis ole32 biblioteku u svoj projekat. Dakle, u linker sekciji ubaci: -lole32 .