【问题标题】:Detect Windows Mobile vs. "plain" Windows CE检测 Windows Mobile 与“普通”Windows CE
【发布时间】:2011-12-29 10:32:44
【问题描述】:
我的 Compact Framework 应用程序如何检测它是否在 Windows Mobile(顶部的开始菜单,底部的菜单栏)而不是 “普通”Windows CE 下运行(底部的开始菜单,应用程序内的菜单栏)?
由于 Windows Mobile 在 Windows CE 内核之上运行,Environment.OSVersion.Version 在这里并没有真正的帮助(它只是返回 CE 内核版本号)。
【问题讨论】:
标签:
c#
.net
windows-mobile
compact-framework
windows-ce
【解决方案2】:
您还可以检查是否存在 Microsoft.WindowsMobile 和 Microsoft.WindowsMobile.Status 程序集... CE 不包含 WM 在 CE 代码库之上分层的这些附加插件。
【解决方案3】:
我们使用这样的东西。但是每个 CE 设备可能会返回不同的字符串。
[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();
【解决方案4】:
从 Framework 3.5 开始,Microsoft.WindowsCE.Forms 命名空间中有一个属性 SystemSettings.Platform 提供此信息(返回 WinCEGeneric、PocketPC 或 Smartphone)。