Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Determining if application is running on XP Tablet PC edition

37 views
Skip to first unread message

Ryan McFall

unread,
Jul 9, 2004, 2:31:50 PM7/9/04
to
Hi:

Does anyone know of a way to determine whether an application (in this case
C#.NET) is running under the XP Tablet PC edition? I've tried using the
information returned from System.Environment.OSVersion, but both the Version
and Platform properties seem to return the same thing on XP Pro and Tablet
PC edition.

I've thought of looking for the inking DLL's, and if they exist using calls
to enumerate the tablet devices, but that seems like more trouble than it's
worth.

Thanks for any help,
Ryan


Fritz Switzer

unread,
Jul 9, 2004, 2:58:50 PM7/9/04
to
Ryan,

Import User32.dll and then call GetSystemMetrics with the value '86'.

const int SM_TABLETPC = 86;
[DllImport("user32.dll")]
private static extern int GetSystemMetrics(int nIndex);

private void btnIsTablet_Click(object sender, System.EventArgs e)
{
if (GetSystemMetrics(SM_TABLETPC) != 0)
MessageBox.Show("Yes, this IS a tablet");
else
MessageBox.Show("No, this IS NOT a tablet");
}

Make sure you add "using System.Runtime.InteropServices;"

Additional notes can be found in the SDK like creating recognizer
instances, etc.

Hope this helps,

Fritz


--
Fritz Switzer
Microsoft MVP Tablet PC
www.abletfactory.com

"Ryan McFall" <mcf...@Hope.edu> wrote in message
news:%23EW0BMe...@TK2MSFTNGP12.phx.gbl...

Ryan McFall

unread,
Jul 13, 2004, 7:25:12 AM7/13/04
to
Thanks, Fritz, that did the trick.

That's twice now recently that I've looked in all the documentation I can
think of before posting, and have missed the obvious one!
Ryan

"Fritz Switzer" <fritz....@abletfactory.com> wrote in message
news:O5h9Kbe...@TK2MSFTNGP12.phx.gbl...

Fritz Switzer

unread,
Jul 13, 2004, 10:15:59 AM7/13/04
to
Ryan,

Well, this one is a bit off the path. I think I came across it in the
Tablet FAQ or somewhere like that.

Glad it helped,

Fritz

--
Fritz Switzer
Microsoft MVP Tablet PC
www.abletfactory.com

"Ryan McFall" <mcf...@Hope.edu> wrote in message

news:egDBTwMa...@TK2MSFTNGP10.phx.gbl...

Mark Teal

unread,
Jul 27, 2004, 5:21:05 PM7/27/04
to
Thought I'd add the VB.Net translation for that code (for those of us using VB.Net to develop our Tablet PC applications):

Imports System.Runtime.InteropServices

Declare Auto Function GetSystemMetrics Lib "user32" (ByVal nIndex As Integer) As Integer
Private Const SM_TABLETPC As Integer = 86

If GetSystemMetrics(SM_TABLETPC) <> 0 Then
msgbox("Yes, this IS a tablet")
Else
msgbox("No, this IS NOT a tablet")
End If

--
Mark Teal
www.bodytrans.com

0 new messages