How to identify device is tablet or not in winform
I have worked on desktop application, in this application is using for image capturing in desktop or tablet. I had found one problem is that camera was not rotate. I have using video capturing device in desktop-pc like as webcam and in the table have rear and front camera.Webcam not require rotation but in tablet is rotation require because tablet is rotate landscape to portrait or landscape or landscape-flipped vis versa.
So I had decided when system is tablet then camera is rotate else not.I had using blow code for system is tablet.
I have write this post for identify the user's device is desktop-pc or tablet. I have wrote some snippet code's
Using the name space in in winform....
using System.Runtime.InteropServices;
snippte code using is tablet is identify
private static readonly int SM_TABLETPC = 0x56;
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto, EntryPoint = "GetSystemMetrics")]
private static extern int GetSystemMetrics(int nIndex)
if ((GetSystemMetrics(SM_TABLETPC) != 0))
{
MessageBox.Show("This system is a tablet");
} else
{
MessageBox.Show("This system is not a tablet");
}
So I had decided when system is tablet then camera is rotate else not.I had using blow code for system is tablet.
I have write this post for identify the user's device is desktop-pc or tablet. I have wrote some snippet code's
Using the name space in in winform....
using System.Runtime.InteropServices;
snippte code using is tablet is identify
private static readonly int SM_TABLETPC = 0x56;
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto, EntryPoint = "GetSystemMetrics")]
private static extern int GetSystemMetrics(int nIndex)
if ((GetSystemMetrics(SM_TABLETPC) != 0))
{
MessageBox.Show("This system is a tablet");
} else
{
MessageBox.Show("This system is not a tablet");
}
Comments
Post a Comment