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

推荐订阅源

Cloudbric
Cloudbric
Schneier on Security
Schneier on Security
V2EX - 技术
V2EX - 技术
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
O
OpenAI News
S
Security @ Cisco Blogs
Scott Helme
Scott Helme
Security Archives - TechRepublic
Security Archives - TechRepublic
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
WordPress大学
WordPress大学
云风的 BLOG
云风的 BLOG
T
Threatpost
Hacker News: Ask HN
Hacker News: Ask HN
Microsoft Azure Blog
Microsoft Azure Blog
Know Your Adversary
Know Your Adversary
博客园 - 三生石上(FineUI控件)
A
About on SuperTechFans
Forbes - Security
Forbes - Security
NISL@THU
NISL@THU
Security Latest
Security Latest
G
Google Developers Blog
D
Docker
T
Threat Research - Cisco Blogs
N
Netflix TechBlog - Medium
C
CERT Recently Published Vulnerability Notes
H
Help Net Security
B
Blog
Martin Fowler
Martin Fowler
N
News and Events Feed by Topic
Simon Willison's Weblog
Simon Willison's Weblog
Hacker News - Newest:
Hacker News - Newest: "LLM"
L
Lohrmann on Cybersecurity
Y
Y Combinator Blog
PCI Perspectives
PCI Perspectives
F
Fortinet All Blogs
MyScale Blog
MyScale Blog
Project Zero
Project Zero
爱范儿
爱范儿
Cisco Talos Blog
Cisco Talos Blog
博客园 - 聂微东
Hugging Face - Blog
Hugging Face - Blog
人人都是产品经理
人人都是产品经理
V
Vulnerabilities – Threatpost
P
Proofpoint News Feed
Cyberwarzone
Cyberwarzone
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
TaoSecurity Blog
TaoSecurity Blog
N
News | PayPal Newsroom
Recorded Future
Recorded Future

博客园 - 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();

      }


    }