FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Mac Address
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Mac Address
Posted: Sun May 31, 2009 09:28 AM

How read a Mac Address of a pc ?

Best Regards, Saludos



Falconi Silvio
Posts: 401
Joined: Thu Oct 06, 2005 10:15 PM
Re: Mac Address
Posted: Sun May 31, 2009 11:57 AM
Code (fw): Select all Collapse
GetNetCardId()
Saludos,



Pablo Alberto Vidal

/*

------------------------------------------------------

Harbour 3.2.0, Fivewin 17.02, BCC7

------------------------------------------------------

*/
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: Mac Address
Posted: Sun May 31, 2009 12:09 PM

I try it allready but it return a array ....

Best Regards, Saludos



Falconi Silvio
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Mac Address
Posted: Sun May 31, 2009 02:21 PM
If you have more then one network-connection, the functions returs an array, otherwise you directly get the MAC-adres

see http://forums.fivetechsupport.com/viewtopic.php?f=3&t=9631&p=46355&hilit=getnetcardid#p46355

Marc
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 1054
Joined: Sun Oct 09, 2005 10:41 PM
Re: Mac Address
Posted: Sun May 31, 2009 04:06 PM

Hi SIlvio:

Function GetMacAdd()
local aMac, cRet

TRY
aMac := GetNetCardID()
CATCH
aMac := ""
END

IF VALTYPE(aMac) = "U" // no hay tarjera de red instalada
Return("")
EndIf
IF VALTYPE(aMac) = "A" // hay varias tarjetas de red
If LEN(aMac) = 0
cRet := ""
Else
cRet := aMac[1]
EndIf
EndIf
If VALTYPE(aMac) = "C"
cRet := aMac // una sola t de red
EndIf
Return(cRet)

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: Mac Address
Posted: Sun May 31, 2009 05:52 PM

but for each computer there an unique mac address???

Best Regards, Saludos



Falconi Silvio
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Mac Address
Posted: Sun May 31, 2009 10:47 PM

Each ethernet card has a unique mac address .. it is the network card not the computer. Some computers may have more than one ethernet card in them .. that is why you may get the array with multiple addresses.

Rick Lipkin

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: Mac Address
Posted: Mon Jun 01, 2009 09:16 AM

I want protect My application with this system but I can have one pc not with net card ... and then How I protect it ?
How can read the key serial of the computer ( no hdserial)

Best Regards, Saludos



Falconi Silvio
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Mac Address
Posted: Mon Jun 01, 2009 01:16 PM

Silvo

There is NO good answer .. I am in State gov here with over 4k users .. One thing that I can tell you .. computers get moved, network cards go bad, infrastructure changes, new computers are always moved in and put in place, virus cause all kinds of problems and hard drives that have to be re-formatted ..

Just don't think a 'perfect' solution would be to rely on a Mac address .. just too much of a ( possible ) moving target. If you are looking at a small group of people using your application .. perhaps a 'dongle' attached to a serial, usb or parallel port wouild be better ..

Just my 2 cents worth ..

Rick

Continue the discussion