请问 设备ID 是什么意思?是手机监控设备哪个牌子好的软件

&&&&&&&&&&&&&
最近公司要做一个用户操作手机应用的监控程序,主要是客户体验手机在营业厅中给用户使用的过程中记录用户使用手机中各项应用的次数和时间.
为了解决这个问题,我在网上找了很久,几乎无例外都是C++编写的,而且大部分都是运行于PC的,在手机上的相关例子太少了.
无废话,上代码,方便以后自己查看:
第一个文件: UsbSocketHelper.cs,此文件主要实现手机直接通过usb连接到pc后在手机通过socket以tcp方式发送消息到pc端:
UsbSocketHelper.cs代码
using Susing System.Nusing System.Net.Susing System.Tnamespace G3PcocessListener{
public class UsbSocketHelper
/// &summary&
/// 发送消息到PC机的Tcp端口,默认端口为:8888
/// &/summary&
/// &param name="info"&要发送的消息&/param&
public static bool SendInfo(string info)
string errM
return SendInfo(info, 8888, out errMsg);
/// &summary&
/// 发送消息到PC机的Tcp端口,默认端口为:8888
/// &/summary&
/// &param name="info"&要发送的消息&/param&
/// &param name="errMsg"&运行时发生的错误的提示信息&/param&
public static bool SendInfo(string info, out string errMsg)
return SendInfo(info, 8888, out errMsg);
/// &summary&
/// 发送消息到PC机的Tcp端口,默认端口为:8888
/// &/summary&
/// &param name="info"&要发送的消息&/param&
/// &param name="port"&远程服务器端的TCP端口&/param&
/// &param name="errMsg"&运行时发生的错误的提示信息&/param&
public static bool SendInfo(string info, int port, out string errMsg)
errMsg = string.E
IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName());
IPEndPoint localIpEndPoint = new IPEndPoint(host.AddressList[0], 0);
IPHostEntry rhost = Dns.GetHostEntry("ppp_peer");
IPAddress rhost_ipaddr = rhost.AddressList[0];
IPEndPoint RemoteIpEndPoint = new IPEndPoint(rhost_ipaddr, port);//远程服务器端
Byte[] sendBytes = Encoding.ASCII.GetBytes(info);
using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
socket.Bind(localIpEndPoint);
socket.Connect(RemoteIpEndPoint);
socket.Send(sendBytes, SocketFlags.None);
socket.Close();
return true;
catch (Exception ex)
errMsg = ex.M
return false;
//end of class
第二个文件SystemInfoHelper.cs,此文件主要用于获取手机所使用的平台及版本:
SystemInfoHelper.cs代码
using Snamespace G3PcocessListener{
public class SystemInfoHelper
public PlatformID PlatformID { get; set; }
public Version Version { get; set; }
public SystemInfoHelper()
OperatingSystem myOS = System.Environment.OSV
PlatformID = myOS.P
Version = myOS.V
第三个文件ProcessEnumerator.cs,此文件用来枚举手机当前运行的进程:
ProcessEnumerator.cs代码
using Susing System.Collections.Gusing System.Runtime.InteropSnamespace ToolHelpApi{
/// &summary&
/// 进程实体类
/// &/summary&
public class ProcEntry
public string ExeN
public uint ID;
/// &summary&
/// 实现IEqualityComparer接口,用来实现IEnumerable&ProcEntry& tmpList = newestList.Distinct(new Comparer4ProcEntry());
/// &/summary&
public class Comparer4ProcEntry : IEqualityComparer&ProcEntry&
#region IEqualityComparer&ProcEntry& 成员
public bool Equals(ProcEntry x, ProcEntry y)
if (x == null && y == null) return false;
return x.ExeName.Equals(y.ExeName, StringComparison.CurrentCultureIgnoreCase) && x.ID == y.ID;
public int GetHashCode(ProcEntry obj)
return obj.ToString().GetHashCode();
#endregion
/// &summary&
/// 进程枚举器
/// &/summary&
public class ProcessEnumerator
#region Constants
private const uint TH32CS_SNAPPROCESS = 0x;
private const uint TH32CS_SNAPNOHEAPS = 0x; // optimization to not snapshot heaps
private const uint TH32CS_SNAPHEAPLIST = 0x;
private const uint TH32CS_SNAPTHREAD = 0x;
private const uint TH32CS_SNAPMODULE = 0x;
private const uint TH32CS_SNAPALL = (TH32CS_SNAPHEAPLIST | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD | TH32CS_SNAPMODULE);
private const uint TH32CS_GETALLMODS = 0x;
private const int MAX_PATH = 260;
#endregion
#region Structs
/// &summary&
/// 进程结构体
/// &/summary&
public struct PROCESSENTRY
public uint dwS
public uint cntU
public uint th32ProcessID;
public uint th32DefaultHeapID;
public uint th32ModuleID;
public uint cntT
public uint th32ParentProcessID;
public int pcPriClassB
public uint dwF
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_PATH)]
public string szExeF
uint th32MemoryB
uint th32AccessK
#endregion
#region P/Invoke
[DllImport("toolhelp.dll")]
private static extern IntPtr CreateToolhelp32Snapshot(uint flags, uint processID);
[DllImport("toolhelp.dll")]
private static extern int CloseToolhelp32Snapshot(IntPtr snapshot);
[DllImport("toolhelp.dll")]
private static extern int Process32First(IntPtr snapshot, ref PROCESSENTRY processEntry);
[DllImport("toolhelp.dll")]
private static extern int Process32Next(IntPtr snapshot, ref PROCESSENTRY processEntry);
#endregion
#region public Methods
/// &summary&
/// 枚举当前活动进程
/// &/summary&
/// &param name="list"&&/param&
/// &returns&&/returns&
public static bool Enumerate(ref List&ProcEntry& list)
if (list == null)
return false;
list.Clear();
IntPtr snapshot_ = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (snapshot_ == IntPtr.Zero)
return false;
PROCESSENTRY entry_ = new PROCESSENTRY();
entry_.dwSize = (uint)Marshal.SizeOf(entry_);
if (Process32First(snapshot_, ref entry_) == 0)
CloseToolhelp32Snapshot(snapshot_);
return false;
ProcEntry procEntry = new ProcEntry();
procEntry.ExeName = entry_.szExeF
procEntry.ID = entry_.th32ProcessID;
list.Add(procEntry);
entry_.dwSize = (uint)Marshal.SizeOf(entry_);
while (Process32Next(snapshot_, ref entry_) != 0);
CloseToolhelp32Snapshot(snapshot_);
return true;
private static bool KillProcess(uint procID)
System.Diagnostics.Process proc_ = System.Diagnostics.Process.GetProcessById((int)procID);
proc_.Kill();
proc_.Dispose();
return true;
catch (ArgumentException)
return false; //process does not exist
catch (Exception)
return false; //cannot kill process (perhaps its system process)
#endregion
第四个文件WindowsEnumerator.cs,此文件主要是获取当前用户操作的窗口,并得到创建该窗口的进程标记:
WindowsEnumerator.cs代码
using Susing System.Lusing System.Collections.Gusing System.Tusing System.Runtime.InteropSnamespace CoredllApi{
public class WindowsEnumerator
[DllImport("coredll.dll")]
private static extern IntPtr GetForegroundWindow();
[DllImport("coredll.dll")]
private static extern uint GetWindowThreadProcessId(IntPtr hwnd, ref uint lpdwProcessId);
public static bool Enumerate(ref uint procId)
if (procId == null)
procId = 0;
IntPtr hwnd = GetForegroundWindow();
if (hwnd == IntPtr.Zero)
return false;
GetWindowThreadProcessId(hwnd, ref procId);
return true;
//public static bool Enumerate(ref List&ProcEntry& list, ref ProcEntry proc)
if (list == null)
IntPtr hwnd = GetForegroundWindow();
if (hwnd == IntPtr.Zero)
uint pid = 0;
GetWindowThreadProcessId(hwnd, ref pid);
ProcEntry proc_ = new ProcEntry();
foreach (ProcEntry item in list)
if (item.ID == pid)
proc = proc_;
//end of class
第五个ProcessListener.cs,此文件用来监听并发送消息:
ProcessListener.cs代码
using Susing System.Collections.Gusing System.Lusing System.Tusing ToolHelpAusing CoredllAnamespace G3PcocessListener{
public class ProcessListener
//private static List&ProcEntry& procList = new List&ProcEntry&();
private static List&ProcEntry& newestList = new List&ProcEntry&();//最新进程列表
private static uint lastProcId = 0;//上次活动窗体对应的进程标记
#region 单例模式:饿汉式
private static ProcessListener _instance = new ProcessListener();
public static ProcessListener Instance
get { return _ }
private ProcessListener()
//procList.Clear();
//ProcessEnumerator.Enumerate(ref procList);
//procList = procList.Distinct(new Comparer4ProcEntry()).ToList();
#endregion
//private void FindNewestProcess()
if (ProcessEnumerator.Enumerate(ref newestList))
List&ProcEntry& tmpList = newestList.Distinct(new Comparer4ProcEntry()).ToList();
List&ProcEntry& newList = tmpList.Except(procList, new Comparer4ProcEntry()).ToList();
foreach (ProcEntry item in newList)
UsbSocketHelper.SendInfo(item.ExeName + System.Environment.NewLine);
procList.Clear();
procList.AddRange(tmpList);
newestList.Clear();
private void FindNewestWindow()
uint currentProcId = 0;
if (WindowsEnumerator.Enumerate(ref currentProcId))
if (currentProcId != lastProcId)
lastProcId = currentProcId;//记录当前活动窗体对应的进程标记
if (ProcessEnumerator.Enumerate(ref newestList))
ProcEntry proc_ = newestList.Find(item =& item.ID == currentProcId);
if (!string.IsNullOrEmpty(proc_.ExeName))
UsbSocketHelper.SendInfo(proc_.ExeName + System.Environment.NewLine);
//private void FindNewestWindow()
ProcEntry proc=new ProcEntry();
if (ProcessEnumerator.Enumerate(ref newestList))
if (WindowsEnumerator.Enumerate(ref newestList,ref proc))
UsbSocketHelper.SendInfo(proc.ExeName + System.Environment.NewLine);
public void Listen(object stateInfo)
AutoResetEvent autoEvent = (AutoResetEvent)stateI
//FindNewestProcess();
FindNewestWindow();
Thread.Sleep(1000);
autoEvent.Set();
第六个文件就是Program.cs啦,无废话:
Program.cs代码
using System.Tnamespace G3PcocessListener{
class Program
static void Main(string[] args)
AutoResetEvent autoEvent = new AutoResetEvent(true);
ProcessListener.Instance.Listen(autoEvent);
Thread.Sleep(1000);
} while (autoEvent.WaitOne());
autoEvent.WaitOne();
后续再研究怎么把这个程序安装到WinCe中,使实现开机自动运行.
&posted on
阅读(...) 评论()知道iphone id能监控手机吗_百度知道
知道iphone id能监控手机吗
我有更好的答案
知id和密码才可以
采纳率:70%
来自团队:
不联网也不行。温馨提醒下,此功能可以提供对方的位置给你。另外,需要你的设备和另外一个设备都开启这个功能才行,还有就是,对方必须联网,也会把你的位置提供给对方。所以在设置里 找到icloud 里面有一个“查找我的iPhone”,打开就可以了
利用第三方软件可以。
为您推荐:
其他类似问题
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。

我要回帖

更多关于 设备监控系统 的文章

 

随机推荐