Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hard Disk Serial Number
Message
De
11/07/2009 20:05:55
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Divers
Thread ID:
01411564
Message ID:
01411648
Vues:
50
Thanks, John -- and Tracy, too! CPU # is definitely the better way to go
(although I still can't figure out why WMI is returning NULLs for my
HD props).

-mark

=============================

>>>I use the cpu serial number for this type protection.
>>>
>>
>>PMFJI,
>>
>>Would you mind sharing a code of getting the CPU serial number? Thanks.
>
>No problem. I found this WSH code somewhere on the internet in '06 and have found it to be very useful.
>
>*** wmi_systeminfo.prg
>* John Harvey
>* wsh code converted to VFP to capture system informstion
>* 9/30/2006
>*
>*
>CREATE CURSOR tsystem (name c(80),value c(80))
>
>wbemFlagReturnImmediately = 16
>wbemFlagForwardOnly = 32
>strComputer = "."
>
>objWMIService = GetObject("winmgmts:\\" + strComputer + "\root\CIMV2")
>colItems = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL",wbemFlagReturnImmediately + wbemFlagForwardOnly)
>   For Each objItem In colItems
>
>      ?"BootDevice: " + trans(objItem.BootDevice)
>      ?"BuildNumber: " + trans(objItem.BuildNumber)
>      ?"BuildType: " + trans(objItem.BuildType)
>      ?"Caption: " + trans(objItem.Caption)
>      ?"CodeSet: " + trans(objItem.CodeSet)
>      ?"CountryCode: " + trans(objItem.CountryCode)
>      ?"CreationClassName: " + trans(objItem.CreationClassName)
>      ?"CSCreationClassName: " + trans(objItem.CSCreationClassName)
>      ?"CSDVersion: " + trans(objItem.CSDVersion)
>      ?"CSName: " + trans(objItem.CSName)
>      ?"CurrentTimeZone: " + trans(objItem.CurrentTimeZone)
>      ?"DataExecutionPrevention_32BitApplications: " + trans(objItem.DataExecutionPrevention_32BitApplications)
>      ?"DataExecutionPrevention_Available: " + trans(objItem.DataExecutionPrevention_Available)
>      ?"DataExecutionPrevention_Drivers: " + trans(objItem.DataExecutionPrevention_Drivers)
>      ?"DataExecutionPrevention_SupportPolicy: " + trans(objItem.DataExecutionPrevention_SupportPolicy)
>      ?"Debug: " + trans(objItem.Debug)
>      ?"Description: " + trans(objItem.Description)
>      ?"Distributed: " + trans(objItem.Distributed)
>      ?"EncryptionLevel: " + trans(objItem.EncryptionLevel)
>      ?"ForegroundApplicationBoost: " + trans(objItem.ForegroundApplicationBoost)
>      ?"FreePhysicalMemory: " + trans(objItem.FreePhysicalMemory)
>      ?"FreeSpaceInPagingFiles: " + trans(objItem.FreeSpaceInPagingFiles)
>      ?"FreeVirtualMemory: " + trans(objItem.FreeVirtualMemory)
>      ?"InstallDate: " + WMIDateStringToDate(trans(objItem.InstallDate))
>      ?"LargeSystemCache: " + trans(objItem.LargeSystemCache)
>      ?"LastBootUpTime: " + WMIDateStringToDate(trans(objItem.LastBootUpTime))
>      ?"LocalDateTime: " + WMIDateStringToDate(trans(objItem.LocalDateTime))
>      ?"Locale: " + trans(objItem.Locale)
>      ?"Manufacturer: " + trans(objItem.Manufacturer)
>      ?"MaxNumberOfProcesses: " + trans(objItem.MaxNumberOfProcesses)
>      ?"MaxProcessMemorySize: " + trans(objItem.MaxProcessMemorySize)
>      ?"Name: " + trans(objItem.Name)
>      ?"NumberOfLicensedUsers: " + trans(objItem.NumberOfLicensedUsers)
>      ?"NumberOfProcesses: " + trans(objItem.NumberOfProcesses)
>      ?"NumberOfUsers: " + trans(objItem.NumberOfUsers)
>      ?"Organization: " + trans(objItem.Organization)
>      ?"OSLanguage: " + trans(objItem.OSLanguage)
>      ?"OSProductSuite: " + trans(objItem.OSProductSuite)
>      ?"OSType: " + trans(objItem.OSType)
>      ?"OtherTypeDescription: " + trans(objItem.OtherTypeDescription)
>      ?"PlusProductID: " + trans(objItem.PlusProductID)
>      ?"PlusVersionNumber: " + trans(objItem.PlusVersionNumber)
>      ?"Primary: " + trans(objItem.Primary)
>      ?"ProductType: " + trans(objItem.ProductType)
>      ?"QuantumLength: " + trans(objItem.QuantumLength)
>      ?"QuantumType: " + trans(objItem.QuantumType)
>      ?"RegisteredUser: " + trans(objItem.RegisteredUser)
>      ?"SerialNumber: " + trans(objItem.SerialNumber)
>      ?"ServicePackMajorVersion: " + trans(objItem.ServicePackMajorVersion)
>      ?"ServicePackMinorVersion: " + trans(objItem.ServicePackMinorVersion)
>      ?"SizeStoredInPagingFiles: " + trans(objItem.SizeStoredInPagingFiles)
>      ?"Status: " + trans(objItem.Status)
>      ?"SuiteMask: " + trans(objItem.SuiteMask)
>      ?"SystemDevice: " + trans(objItem.SystemDevice)
>      ?"SystemDirectory: " + trans(objItem.SystemDirectory)
>      ?"SystemDrive: " + trans(objItem.SystemDrive)
>      ?"TotalSwapSpaceSize: " + trans(objItem.TotalSwapSpaceSize)
>      ?"TotalVirtualMemorySize: " + trans(objItem.TotalVirtualMemorySize)
>      ?"TotalVisibleMemorySize: " + trans(objItem.TotalVisibleMemorySize)
>      ?"Version: " + trans(objItem.Version)
>      ?"WindowsDirectory: " + trans(objItem.WindowsDirectory)
>   Next
>
>Function WMIDateStringToDate(dtmDate)
>	return substr(dtmDate, 5, 2) + "/" + substr(dtmDate, 7, 2) + "/" + Left(dtmDate, 4) + " " + substr(dtmDate, 9, 2) 
>End Function
>
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform