惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
SegmentFault 最新的问题
Last Week in AI
Last Week in AI
阮一峰的网络日志
阮一峰的网络日志
Cloudbric
Cloudbric
www.infosecurity-magazine.com
www.infosecurity-magazine.com
S
Security @ Cisco Blogs
月光博客
月光博客
T
Troy Hunt's Blog
H
Help Net Security
Forbes - Security
Forbes - Security
博客园 - 叶小钗
Apple Machine Learning Research
Apple Machine Learning Research
IT之家
IT之家
L
LINUX DO - 最新话题
Hacker News - Newest:
Hacker News - Newest: "LLM"
GbyAI
GbyAI
S
Schneier on Security
Spread Privacy
Spread Privacy
Attack and Defense Labs
Attack and Defense Labs
Blog — PlanetScale
Blog — PlanetScale
N
News | PayPal Newsroom
F
Fortinet All Blogs
Latest news
Latest news
人人都是产品经理
人人都是产品经理
Recent Announcements
Recent Announcements
博客园_首页
Martin Fowler
Martin Fowler
Stack Overflow Blog
Stack Overflow Blog
雷峰网
雷峰网
O
OpenAI News
I
Intezer
S
Security Affairs
罗磊的独立博客
T
Tailwind CSS Blog
小众软件
小众软件
P
Palo Alto Networks Blog
Help Net Security
Help Net Security
V
Vulnerabilities – Threatpost
博客园 - 【当耐特】
F
Full Disclosure
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
J
Java Code Geeks
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 聂微东
博客园 - 司徒正美
T
The Exploit Database - CXSecurity.com
L
Lohrmann on Cybersecurity
C
Cisco Blogs
Security Latest
Security Latest

博客园 - 钟少

关于 MonoDevelop on Linux 单步调试问题的解决 MonoDevelop 4.2.2/Mono 3.4.0 in CentOS 6.5 安装笔记 在ASP.NET MVC 4 on Mono中使用OracleClient in CentOS 6.x的问题记录 在CentOS 6.4 x86_32中使用Rhythmbox听MP3 MonoDevelop 4.0.9 on CentOS 6.3 安装笔记 MemoryMappedFile 在 Mono in Linux 的开发笔记 Mono on CentOS 6.3 安装笔记 在OpenSUSE中听歌 ASP.NET MVC 3.0 源码阅读手记(1) Mono on Linux 开发与实践札记(1) 数据库连接字符串解析的正则表达式 我的WPF学习札记(1) 我的插件框架·前传 恢复Ico图标文件在资源管理器中的显示 深入剖析 ASP.NET 1.x 中 Forms 身份验证(1) 北大青鸟(深圳中青)培训中心招聘: .NET 讲师 .NET 2.0 中的自定义配置处理 一个三层架构的WinForms程序的完整范例(.NET 1.1/Northwind) IIS6.0服务器架站无法访问解决方案总结(转贴)
在Windows Mobile中检测应用程序是否运行在模拟器中
钟少 · 2011-04-11 · via 博客园 - 钟少

原文地址:http://blogs.msdn.com/b/netcfteam/archive/2006/09/15/756755.aspx

代码如下:

using System;
using System.IO;
using System.Windows.Forms;
using Microsoft.Win32;
using System.Runtime.InteropServices;
using System.Text;namespace PlatformDetection
{
internal partial class PInvoke
{
[DllImport(
"Coredll.dll", EntryPoint = "SystemParametersInfoW", CharSet = CharSet.Unicode)]
static extern int SystemParametersInfo4Strings(uint uiAction, uint uiParam, StringBuilder pvParam, uint fWinIni);public enum SystemParametersInfoActions : uint
{
SPI_GETPLATFORMTYPE
= 257, // this is used elsewhere for Smartphone/PocketPC detection
SPI_GETOEMINFO = 258,
}
public static string GetOemInfo()
{
StringBuilder oemInfo
= new StringBuilder(50);
if (SystemParametersInfo4Strings((uint)SystemParametersInfoActions.SPI_GETOEMINFO,
(
uint)oemInfo.Capacity, oemInfo, 0) == 0)
throw new Exception("Error getting OEM info.");
return oemInfo.ToString();
}

}

internal partial class PlatformDetection
{
private const string MicrosoftEmulatorOemValue = "Microsoft DeviceEmulator";
public static bool IsEmulator()
{
return PInvoke.GetOemInfo() == MicrosoftEmulatorOemValue;
}
}
class EmulatorProgram
{
static void Main(string[] args)
{
MessageBox.Show(
"Emulator: " + (PlatformDetection.IsEmulator() ? "Yes" : "No"));
}
}
}