Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get the PC serial number or LAN Card Mac Address
Message
From
27/05/2003 04:25:47
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00792969
Message ID:
00792985
Views:
12
>Hi to all!
>
>I want to derive the activation key of my program base on the unique number on the Computer.
>
>Anyone who knows How to get the PC serial number or LAN Card Mac Address programatically.
>
>Many thanks

Reygie,
Forget about CPU serial. Not all processors have it and it should be enabled for you to get.
function GetMacAddress
Local pGUID,rGUID,lcOldError, lnResult
Declare integer CoCreateGuid in 'OLE32.dll' string @pguid
Declare integer StringFromGUID2 in 'OLE32.dll' ;
  string rguid, string @lpsz, integer cchMax
Declare integer UuidCreateSequential in 'RPCRT4.dll'  string @ Uuid

pGUID=replicate(chr(0),16)
rGUID=replicate(chr(0),80)

lcOldError = On('error')
On Error lnResult = CoCreateGuid(@pGUID)
lnResult = UuidCreateSequential(@pGUID) 
On Error &lcOldError

return substr( iif( lnResult = 0 and ;
	StringFromGUID2(pGUID,@rGUID,40) # 0, ;
    StrConv(left(rGUID,76),6), "" ), 26,12)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform