Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CPU serial number
Message
From
10/05/2002 04:24:58
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
10/05/2002 01:49:58
Jordan Pastourel
Worksafe Management Systems
Toowong, Australia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00654900
Message ID:
00654920
Views:
36
>Hi all,
>i was wondering if there was a way in VFP to get the cpu serial number. i need to get some unique number from the hardware. any ideas?
>
>Jordan

Jordan,
CPU serial number doesn't exist with all CPUs. If computer has an ethernet card than it has a unique manifacturer's code (as a user I'd hate that I can't change my card though).
Local pGUID,rGUID
Declare integer CoCreateGuid in 'OLE32.dll' ;
  string @pguid
Declare integer StringFromGUID2 in 'OLE32.dll' ;
  string rguid, string @lpsz, integer cchMax

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

If "5." $ OS() && 2000/XP
  Declare integer UuidCreateSequential in 'RPCRT4.dll'  string @ Uuid
  lcMacAddress = iif( UuidCreateSequential(@pGUID) = 0 ;
    and StringFromGUID2(pGUID,@rGUID,40) # 0, ;
    substr(StrConv(left(rGUID,76),6),26,12), "" )
* VFP7
*  CLEAR DLLS 'UuidCreateSequential' 
Else
  lcMacAddress = iif( CoCreateGuid(@pGUID) = 0 ;
    and StringFromGUID2(pGUID,@rGUID,40) # 0, ;
    substr(StrConv(left(rGUID,76),6),26,12), "" )
ENDIF
? lcMacAddress
*VFP7
*CLEAR DLLS 'WNetGetUser','GetComputerName','CoCreateGuid','StringFromGUID2'
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