[DllImport("kernel32.dll")]
static extern uint GetVersion();
None.
Retrieves the version number of the current operating system
Please add some!
using System;
using System.Text;
using System.Runtime.InteropServices;
namespace testt
{
class Program
{
static void Main(string[] args)
{
StringBuilder str = new StringBuilder(100);
uint dwWersion = WinAPI.GetVersion();
str.Append(WinAPI.LoByte((ushort)WinAPI.LoWord(dwWersion)));
str.Append(".");
str.Append(WinAPI.HiByte((ushort)WinAPI.LoWord(dwWersion)));
if (dwWersion < 0x80000000)
{
str.Append("." + WinAPI.HiWord(dwWersion).ToString());
}
Console.WriteLine("OS Version is " + str.ToString());
}
}
static class WinAPI
{
public static uint LoWord(uint dwValue)
{
return dwValue & 0xFFFF;
}
public static uint HiWord(uint dwValue)
{
return (dwValue >> 16) & 0xFFFF;
}
public static ushort LoByte(ushort wValue)
{
return (ushort)(wValue & 0xFF);
}
public static ushort HiByte(ushort wValue)
{
return (ushort)((wValue >> 8) & 0xFF);
}
[DllImport("kernel32.dll")]
public static extern uint GetVersion();
}
}
GetVersionEx(), Operating System Version(), VerifyVersionInfo()