FoxPro Programming
How to get the current Windows version?
Gravatar is a globally recognized avatar based on your email address. How to get the current Windows version?
  Yonggu
  All
  May 20, 2025 @ 02:24am

I want to know the current Windows version running the application.

Using the native function, OS() did not produce the desired results.

Would there be a better way?

Gravatar is a globally recognized avatar based on your email address. re: How to get the current Windows version?
  Tore Bleken
  Yonggu
  May 20, 2025 @ 04:07am

This is one solution:

LOCAL WMIService, MySytem, AllSystems
m.WMIService = GETOBJECT("winmgmts:\\.\root\cimv2")

m.AllSystems = m.WMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem",,48)

FOR EACH m.MySytem IN m.AllSystems

	? "Caption:", m.MySytem.Caption
	? "Version:", m.MySytem.Version
	? "BuildNumber:", m.MySytem.BuildNumber

ENDFOR
Gravatar is a globally recognized avatar based on your email address. re: How to get the current Windows version?
  Luca
  Tore Bleken
  May 21, 2025 @ 09:25pm

Great Tore!

© 1996-2025