C# – Get Windows Version and Edition

When we want to find out information about our windows operating system, we can simply enter the “winver” command in command prompt but how we can get these details with c#. So I would like to introduce a code snippet which comes from http://www.csharp411.com/determine-windows-version-and-edition-with-c/ to help us enumerate all information about current windows operating system. I modified this class a little so that it can recognize Windows 7 too because the version of that post does not realize Windows 7.
The main concept of this OSInfo class is using two important API functions

internal static extern bool GetProductInfo(int osMajorVersion,int osMinorVersion,int spMajorVersion,int spMinorVersion,out int edition);
private static extern bool GetVersionEx(ref OSVERSIONINFOEX osVersionInfo);

GetProductInfo Function retrieves the product type for the operating system on the local computer, and maps the type to the product types supported by the specified operating system. To retrieve product type information on versions of Windows prior to the minimum supported operating systems specified in the Requirements section, use the GetVersionEx function. You can also use the OperatingSystemSKU property of the Win32_OperatingSystem WMI class.
GetVersionEx Function retrieves information about the current operating system. Identifying the current operating system is usually not the best way to determine whether a particular operating system feature is present. This is because the operating system may have had new features added in a redistributable DLL. Rather than using GetVersionEx to determine the operating system platform or version number, test for the presence of the feature itself.
To demonstrate how to use this class I wrote a small code snippet below which shows all provided properties

string strOSInfo =
"Operating system: " + OSInfo.Bits.ToString() + " bits" + Environment.NewLine +
"Build version: " + OSInfo.BuildVersion.ToString() + Environment.NewLine +
"Edition: " + OSInfo.Edition.ToString() + Environment.NewLine +
"Major Version: " + OSInfo.MajorVersion.ToString() + Environment.NewLine +
"Minor Version: " + OSInfo.MinorVersion.ToString() + Environment.NewLine +
"Name: " + OSInfo.Name + Environment.NewLine +
"Revision Version: " + OSInfo.RevisionVersion.ToString() + Environment.NewLine +
"Service pack: " + OSInfo.ServicePack + Environment.NewLine +
"Version: " + OSInfo.VersionString;
txtbOSInfo.Text = strOSInfo;

The complete source code you can download here “Windows Version Edition”.

Windows – Desktopography 2009 Win7 theme

The most interesting feature in Windows 7 is changing the desktop wallpaper after given time. With this feature we don’t have a boring wallpaper all time and I like it very much. I can create myself a theme and add many wallpapers that I like and let themselves changed after 15 minutes. And every time when I minimize all of working windows and I’ll see an other wallpaper, that’s just a … small change but anyway it makes my computer more exciting than before. Microsoft offers a lot of themes too. You can find them at following link http://windows.microsoft.com/en-US/windows/downloads/personalize but none of them pleases me.
I have tried a lot of theme (my own one and the others) but what I like at most is theme with Desktopography wallpapers which I choose from the gallery of Desktopography. They are really amazing wallpapers and even can be the best wallpapers of 2009. Therefore I would like to share my theme pack, it is pretty large, about 50 MB but I think it’s worth to download and install as your win7 theme. My own pack is larger but I delete some of wallpapers before sharing because the size is so large. It’s about 80 MB at original size.

Desktopography 2009

You can download it at following link
Mirror 1: http://www.megaupload.com/?d=K033U3E0
Mirror 2: http://ugotfile.com/file/791246/Desktopography2009.themepack
I really respect what the authors of this wallpapers have done. Not only how they design and use color but also their imagination. How can they draw such scenes in their brains? My grandfather always tell me that I should read more fictional novel to improve my imagination. He says that science is good but without imagination human can make any inventive step. I think my grandfather is right because a lot of scientific projects are trying to make some imaginative things to be real.