Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get Windows number
Message
De
18/10/2013 10:50:18
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01585817
Message ID:
01585824
Vues:
66
>Is it possible to retrieve Windows number using VFP ?

using west-wind's wwAPI to read registry
	* =============================================
	FUNCTION cWindowsID As String && productID de Windows
	
	LOCAL luResult as Variant;
	, loAPI AS wwAPI OF wwAPI.prg;
	, objWMI as Object;
	, colClass as Object;
	, objItem as Object
	
	luResult = .NULL. && don't know

	TRY
		loAPI = CreateObject('wwAPI')
		luResult = Nvl(;
			  loAPI.readRegistryString(,'SOFTWARE\Microsoft\Windows NT\CurrentVersion\', 'ProductID');
			, loAPI.readRegistryString(,'SOFTWARE\Microsoft\Windows NT\CurrentVersion\DefaultProductKey\', 'ProductID');
			)
	CATCH
	ENDTRY
	
	IF IsNull(m.luResult) OR Empty(m.luResult)
		
		TRY
			objWMI = GetObject("winmgmts:\\.\root\cimv2")
			colClass = objWMI.ExecQuery("Select * from Win32_OperatingSystem",,48)
			FOR EACH objItem IN colClass
				luResult = objItem.SerialNumber
				IF NOT Empty(m.luResult)
					EXIT
				ENDIF
			ENDFOR	
		CATCH
		ENDTRY
	ENDIF
	
	RETURN m.luResult
Thierry Nivelet
FoxinCloud
Give your VFP application a second life, web-based, in YOUR cloud
http://foxincloud.com/
Never explain, never complain (Queen Elizabeth II)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform