【问题标题】: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


    【解决方案1】:

    如果您愿意参考>> VSD FAQ << 下发布的 Microsoft 的 MSDN 常见问题解答,这是第 10 项:How do I detect the platform and Windows Mobile version?

    我会重新发布,但帖子中有一个小代码示例和几个链接,在这里复制会很耗时。

    【讨论】:

      【解决方案2】:

      您还可以检查是否存在 Microsoft.WindowsMo​​bile 和 Microsoft.WindowsMo​​bile.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)。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2011-03-02
            • 2010-10-27
            • 1970-01-01
            • 1970-01-01
            • 2014-02-02
            • 2011-05-15
            • 2023-03-19
            • 1970-01-01
            相关资源
            最近更新 更多