Am I running on a Tablet PC?

If you develop for Windows XP and want to take advantage of Tablet PC specific features when your application is run on a tablet, there’s a simple way to find out.  Just call the Win32 API GetSystemMetrics with the magic number 86:

using System.Runtime.InteropServices;

// System metric constant for Windows XP Tablet PC Edition
private const int SM_TABLETPC = 86;

public static bool IsTabletPC()
return (GetSystemMetrics(SM_TABLETPC) != 0);

private static extern int GetSystemMetrics(int nIndex);

Skip to main content