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

推荐订阅源

Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
S
Security Affairs
P
Palo Alto Networks Blog
Webroot Blog
Webroot Blog
P
Privacy International News Feed
H
Hacker News: Front Page
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cybersecurity and Infrastructure Security Agency CISA
Recent Commits to openclaw:main
Recent Commits to openclaw:main
T
The Blog of Author Tim Ferriss
T
Threat Research - Cisco Blogs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Schneier on Security
Schneier on Security
Jina AI
Jina AI
Simon Willison's Weblog
Simon Willison's Weblog
Scott Helme
Scott Helme
A
About on SuperTechFans
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Recorded Future
Recorded Future
F
Fortinet All Blogs
PCI Perspectives
PCI Perspectives
Google DeepMind News
Google DeepMind News
T
Troy Hunt's Blog
MyScale Blog
MyScale Blog
I
InfoQ
F
Full Disclosure
宝玉的分享
宝玉的分享
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Security Archives - TechRepublic
Security Archives - TechRepublic
Latest news
Latest news
W
WeLiveSecurity
月光博客
月光博客
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
N
Netflix TechBlog - Medium
量子位
P
Proofpoint News Feed
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
GbyAI
GbyAI
SecWiki News
SecWiki News
AI
AI
The Last Watchdog
The Last Watchdog
Hacker News - Newest:
Hacker News - Newest: "LLM"
G
GRAHAM CLULEY
N
News and Events Feed by Topic
K
Kaspersky official blog
V2EX - 技术
V2EX - 技术

博客园 - ruinet

WCF通用服务请求类 使用MVP模式实现B/S和C/S平台的功能通用 WCF中使用扩展行为来验证连接的用户 Microsoft.Practices.Unity依赖注入使用实例 简洁的Asp.net菜单控件 Windows Mobile无线打印的实现 使用HTML,CSS快速导出数据到Excel 软件技术网站精选 CakePHP架构入门 升级Sql Server 2000到Sql Server 2005中要注意的问题 asp.net web开发综合技能 编写第一个Silverlight程序 Saas学习 在Windows Mobile上控制输入法 - ruinet - 博客园 在Windows Mobile创建桌面快捷方式 在仿真设备中使用主机网络 CSS,JavaSript,Html实用小代码 使用Ajax控件引发性能问题 智能移动项目打包发布经验交流
重启PocketPC移动设备
ruinet · 2007-10-30 · via 博客园 - ruinet

2007-10-30 16:54  ruinet  阅读(618)  评论()    收藏  举报

PocketPC运行程序经常由于某些不确定的因素,导致程序就死在那里了.但在PocketPC上又没有象桌面Windows一样的任务管理器.所有出现了此问题要么就等个半天,要么就硬重启.下面给大家介绍一段软重启的代码.看过就可以直接拿来使用.

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace ResetPocketPC
{
  
class ResetPocketPC
  
{
    
public const uint FILE_DEVICE_HAL = 0x00000101;
    
public const uint METHOD_BUFFERED = 0;
    
public const uint FILE_ANY_ACCESS = 0;
    
public   uint CTL_CODE(uint DeviceType, uint Function, uint Method, uint Access)
    
{
      
return ((DeviceType << 16| (Access << 14| (Function << 2| Method);
    }

    [DllImport(
"Coredll.dll")]
    
public extern static uint KernelIoControl
    (
        
uint dwIoControlCode,
        IntPtr lpInBuf,
        
uint nInBufSize,
        IntPtr lpOutBuf,
        
uint nOutBufSize,
        
ref uint lpBytesReturned
    );
    
//调用此方法软重启
    public  uint ResetPocketPC()
    
{
      
uint bytesReturned = 0;
      
uint IOCTL_HAL_REBOOT = CTL_CODE(FILE_DEVICE_HAL, 15,METHOD_BUFFERED, FILE_ANY_ACCESS);
      
return KernelIoControl(IOCTL_HAL_REBOOT, IntPtr.Zero, 0,IntPtr.Zero, 0ref bytesReturned);
    }


  }

}

//调用
 private void button1_Click(object sender, EventArgs e)
    
{
      DialogResult r 
= MessageBox.Show(
        
"你确定要重启吗?",
        
"Test",
        MessageBoxButtons.YesNo,
        MessageBoxIcon.Question,
        MessageBoxDefaultButton.Button2
    );

      
if (r == DialogResult.Yes)
      
{
        ResetMobile RsMobile 
= new ResetMobile();
        RsMobile.ResetPocketPC();

      }


    }