Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copy protection
Message
De
18/10/2012 12:42:19
 
 
À
18/10/2012 07:58:40
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Installation et configuration
Titre:
Divers
Thread ID:
01555192
Message ID:
01555255
Vues:
90
>>Hard disks can fail. In an app I'm working on, I use Winmgmt Service to get the CPU serial number and OS serial number, but I must confess that I haven't tried it under various permissions.
>
>It would be interesting to see whether this works in Windows 7.

Be my guest!


-m.
*==============================================================================
* Method:			iApplication.GetCPUid
* Purpose:			Gets the serial number of the CPU.
* Author:			Hammack Development Assoc.
* Parameters:		None.
* Returns:			Character-string alphanumeric processor ID, else "" if
*					not able to determine or error condition encountered.
* Added:			08/27/2009
*==============================================================================

LOCAL loWMI, loCPUs, loCPU, lcResult
loWMI = GETOBJECT("winmgmts:")
IF VARTYPE(loWMI) <> T_OBJECT
	RETURN ""
ENDIF

loCPUs = loWMI.InstancesOf("WIN32_Processor")
IF VARTYPE(loCPUs) <> T_OBJECT OR VARTYPE(loCPUs.Count) <> T_NUMERIC OR loCPUs.Count <> 1
	RETURN ""
ENDIF

FOR EACH loCPU IN loCPUs
	lcResult = loCPU.processorID
	IF VARTYPE(lcResult) = T_NUMERIC AND NOT EMPTY(lcResult)
		lcResult = TRANSFORM(lcResult)
	ENDIF

ENDFOR    && EACH loCPU IN loCPUs

RETURN IIF(VARTYPE(lcResult) = T_CHARACTER AND NOT EMPTY(lcResult), ;
lcResult, "")    && end iApplication.GetCPUid
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform