How do I get system Info such as OS

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I like to know if my application is running on Tablet PC or not and based on
that behave differently. How would I know if the system is Tablet PC or not?

Thanks so much in advance

Al
 
Hi,
I like to know if my application is running on Tablet PC or not and
based on that behave differently. How would I know if the system is
Tablet PC or not?


You can always use WMI... WMI can query just about any system information.

There maybe an easier way, but WMI is probably the most comprehensive.
 
How do I query WMI for Operating system type?

Lucas Tam said:
You can always use WMI... WMI can query just about any system information.

There maybe an easier way, but WMI is probably the most comprehensive.
 
How do I query WMI for Operating system type?

Here's the reference for WMI:

http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/wmisdk/wmi/wmi_reference.asp

Sample on using WMI with Vb.NET:
http://www.freevbcode.com/ShowCode.asp?ID=4571

WMI is pretty neat... you can query WMI via .NET like a SQL database. The
trickiest part with WMI is to find the proper object to query.

You might want to try the class Win32_ComputerSystemProduct. I think the
info your looking for maybe in there:

http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/wmisdk/wmi/win32_computersystemproduct.asp
 
Thank Lucas, I did query the WMI I used the following attributes:

"name" for ComputerName
"version"
"csname" Operating system name
"systemtype"
...
I ran it on my desktop as well as my tablet PC....

Unfortunatly none of these tell me about Tablet PC. The OS name for tablet
PC and regular Desktop is reported as Windows XP. I am not sure which
attributes (if any) contains info about tablet PC.

Thanks again for the help.

Al
 
Lucas i would like to explore Win32_ComputerSystemProduct as you sugested but
where would i get the objects it contains... most of your links to MSDN for
some reason wont work for me.
thanks again
 
* "=?Utf-8?B?QWw=?= said:
I like to know if my application is running on Tablet PC or not and based on
that behave differently. How would I know if the system is Tablet PC or not?

Untested:

Maybe 'Environment.OSVersion' provides enough information for your
needs.
 
* "=?Utf-8?B?QWw=?= said:
In both system it reported as WIndows NT and nothing about Tablet PC.

OK, I could not check that without a tablet PC :-).
 
Al,
According to the Microsoft Tablet PC SDK:

<quote>
Q. How can I determine if my application is running on a Tablet PC?
A. Use the Windows GetSystemMetrics API and pass in SM_TABLETPC as the value
of the index. SM_TABLETPC is defined in Winuser.h. The value of SM_TABLETPC
is 86. The method returns True or nonzero if the Microsoft Windows XP Tablet
PC Edition operating system is running; False or zero otherwise.

Applications should not rely on a true or nonzero value to mean all Tablet
PC components are installed and working. See the following question for
details on how to determine if Tablet PC components are installed.

</quote>

I would expect System.Windows.Forms.SystemInformation would list the value
as it gives most other SystemMetrics, however it appears to be missing
TabletPC (SM_TABLETPC).

You can use code similar to:

Public Enum SystemMetric As Integer
TabletPC = 86
End Enum

Declare Auto Function GetSystemMetrics Lib "User32" (ByVal index As
SystemMetric) As Integer

If GetSystemMetrics(SystemMetric.TabletPC) <> 0 Then
Debug.WriteLine("On a Tablet PC")
Else
Debug.WriteLine("Not on a Tablet PC")
End If

Hope this helps
Jay
 
Hi,

Looked in the Tablet PC SDK. Says to use GetSystemMetrics API to
determine if program is running on a tabletpc.

Declare Function GetSystemMetrics Lib "user32" Alias "GetSystemMetrics" _

(ByVal nIndex As Integer) As Integer

Private Const SM_TABLETPC As Integer = 86



If GetSystemMetrics(SM_TABLETPC) <> 0 Then

MessageBox.Show("Tablet PC")

Else

MessageBox.Show("Non Tablet")

End If





Ken

-----------------------------------

Hi Ken,
I did use PenWindows the value i am getting is false both on Tablet PC as
well as XP running on desktop!
Thanks
Al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top