Heinzi
Heinzi

Reputation: 172200

Detect Windows Mobile vs. "plain" Windows CE

How can my Compact Framework application detect whether it is running under Windows Mobile (Start Menu at top, Menu bar at bottom) as opposed to "plain" Windows CE (Start Menu at bottom, Menu bar inside the application)?

Since Windows Mobile runs on top of the Windows CE kernel, Environment.OSVersion.Version does not really help here (it just returns the CE kernel version number).

Upvotes: 3

Views: 2631

Answers (4)

user153923
user153923

Reputation:

If you would kindly refer to Microsoft's MSDN FAQ posting under >> VSD FAQ <<, this is Item #10: How do I detect the platform and Windows Mobile version?

I would repost, but there is a small code sample and several links in the post that would be time consuming to duplicate here.

Upvotes: 4

BonanzaDriver
BonanzaDriver

Reputation: 6452

You can also check for the existence of the Microsoft.WindowsMobile and Microsoft.WindowsMobile.Status assemblies ... CE doesn't contain these additional add-ons that WM layered on top of the CE code-base.

Upvotes: 2

Damon8or
Damon8or

Reputation: 527

We use something like this. But each CE device will probably return a different string.

        [DllImport("coredll.dll", SetLastError = true)]
    public static extern bool SystemParametersInfoGetString(uint uiAction, uint uiParam, System.Text.StringBuilder pvParam, uint fWinIni);

                System.Text.StringBuilder platformBuff = new System.Text.StringBuilder(100);
                if (SystemParametersInfoGetString(SPI_GETPLATFORMTYPE, (uint)platformBuff.Capacity, platformBuff, 0))
                    return platformBuff.ToString();

Upvotes: 1

Heinzi
Heinzi

Reputation: 172200

Starting with Framework 3.5, there's a property SystemSettings.Platform in the Microsoft.WindowsCE.Forms namespace which provides this information (returning WinCEGeneric, PocketPC or Smartphone).

Upvotes: 2

Related Questions