CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  移动平台 >  Windows Mobile

C#,写windows mobile for smartphone,如何读到设备号?

楼主phaqyxiao(非奇)2006-03-01 14:37:04 在 移动平台 / Windows Mobile 提问

设备号、手机号、sim卡序列号。这些要用API吗,请指点。  
  先奉上100分,不够还有5000多分。 问题点数:100、回复次数:7Top

1 楼phaqyxiao(非奇)回复于 2006-03-01 14:39:04 得分 0

上面我说的手机号是指手机电话号码Top

2 楼phaqyxiao(非奇)回复于 2006-03-06 13:28:08 得分 0

没人指点一下。Top

3 楼phaqyxiao(非奇)回复于 2006-03-13 15:06:21 得分 0

再顶。Top

4 楼flyingbat2(flying_bat)回复于 2006-03-16 16:14:51 得分 0

帮你顶Top

5 楼depascal(阿狼)回复于 2006-03-16 20:01:48 得分 0

在微软的在线msdn可以搜索到这方面的资料Top

6 楼newstarmoon(苍穹)回复于 2006-03-20 15:55:07 得分 0

查寻相关TAPITop

7 楼lbluekey(蓝鸟)回复于 2006-03-20 21:02:20 得分 0

private   static   Int32   FILE_DEVICE_HAL   =   0x00000101;  
  private   static   Int32   FILE_ANY_ACCESS   =   0x0;  
  private   static   Int32   METHOD_BUFFERED   =   0x0;  
   
  private   static   Int32   IOCTL_HAL_GET_DEVICEID   =    
  ((FILE_DEVICE_HAL)   <<   16)   |   ((FILE_ANY_ACCESS)   <<   14)    
  |   ((21)   <<   2)   |   (METHOD_BUFFERED);  
   
   
  [DllImport("coredll.dll")]  
  private   static   extern   bool   KernelIoControl(Int32   IoControlCode,   IntPtr  
  InputBuffer,   Int32   InputBufferSize,   byte[]   OutputBuffer,   Int32  
  OutputBufferSize,   ref   Int32   BytesReturned);  
   
  private   struct   HKEY  
  {  
  //Int32   unused;  
  };  
   
  /*  
    *    
    *    
   
  #define   HKEY_CLASSES_ROOT                       ((   HKEY   )   (ULONG_PTR)0x80000000   )  
  #define   HKEY_CURRENT_USER                       ((   HKEY   )   (ULONG_PTR)0x80000001   )  
  #define   HKEY_LOCAL_MACHINE                     ((   HKEY   )   (ULONG_PTR)0x80000002   )  
  #define   HKEY_USERS                                     ((   HKEY   )   (ULONG_PTR)0x80000003   )  
   
   
    *   */  
   
   
  /*private   static   HKEY   HKEY_CLASSES_ROOT   =   (HKEY)0x80000000;  
  private   static   HKEY   HKEY_CURRENT_USER   =   (HKEY)0x80000001;  
  private   static   HKEY   HKEY_LOCAL_MACHINE   =   (HKEY)0x80000002;  
  private   static   HKEY   HKEY_USERS   =   (HKEY)0x80000003;  
   
  //LONG   APIENTRY RegCloseKey   ( IN   HKEY   hKey);  
   
    *    
    *     455         RegCloseKey  
                        465         RegCopyFile  
                        456         RegCreateKeyExW  
                        457         RegDeleteKeyW  
                        458         RegDeleteValueW  
                        460         RegEnumKeyExW  
                        459         RegEnumValueW  
                      1152         RegFlushKey  
                        461         RegOpenKeyExW  
                      1542         RegOpenProcessKey  
                        462         RegQueryInfoKeyW  
                        463         RegQueryValueExW  
                      1479         RegReplaceKey  
                        466         RegRestoreFile  
                      1478         RegSaveKey  
                        464         RegSetValueExW  
         
   
  [DllImport("Coredll.dll"   ,   EntryPoint="RegCloseKey")]  
  private   static   extern   int   RegCloseKey(ref   HKEY   hKey);  
   
  [DllImport("Coredll.dll"   ,   EntryPoint="RegCreateKeyExW")]  
  private   static   extern   int   RegCreateKeyExW(ref   HKEY   hKey);*/  
   
   
  ==============================  
   
  try  
  {  
  byte[]   OutputBuffer   =   new   byte[256];  
  Int32   OutputBufferSize,   BytesReturned;  
  OutputBufferSize   =   OutputBuffer.Length;  
  BytesReturned   =   0;  
  bool   retVal   =   KernelIoControl(IOCTL_HAL_GET_DEVICEID,    
  IntPtr.Zero,  
  0,  
  OutputBuffer,  
  OutputBufferSize,  
  ref   BytesReturned);  
   
  //   If   the   request   failed,   exit   the   method   now  
  if   (retVal   ==   false)  
  {  
  return   null;  
  }  
           
   
  string   strDeviceInfo="";  
   
  for   (int   i   =   0;   i<OutputBufferSize;   i++)    
   
  {  
   
   
   
  //strNextChar.Format(TEXT("%02X"),   OutputBuffer[i]);  
   
  strDeviceInfo   +=   String.Format("{0:X2}",OutputBuffer[i]);  
   
  }  
   
  string   strDeviceId   =    
   
  strDeviceInfo.Substring(40,2)   +    
   
  strDeviceInfo.Substring(45,9)   +    
   
  strDeviceInfo.Substring(70,6);  
   
   
  return   strDeviceId;  
   
   
  Top

相关问题

  • c#windows
  • windows下的c.
  • C:\WINDOWS\Loadqm.exe
  • Windows API和C
  • c#windows form
  • windows mobile的模拟器如何才能显示smartphone的界面
  • 小鸟问:windows mobile、SmartPhone、Pocket PC、Windows CE.NET的是个什么相互关系?
  • C#能用于Windows编程吗,还是只能用于Mobile和C#.NET服务器
  • C#的windows编程
  • 使用windows mobile操作系统的smartphone用的什么数据库?

关键词

  • 手机
  • 设备
  • hal
  • 指点
  • device
  • static int32
  • private

得分解答快速导航

  • 帖主:phaqyxiao

相关链接

  • CSDN Blog
  • 技术文档
  • 代码下载
  • 第二书店
  • 读书频道

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo