Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get Windows number
Message
From
18/10/2013 10:50:18
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01585817
Message ID:
01585824
Views:
67
>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)
Previous
Reply
Map
View

Click here to load this message in the networking platform