<script>function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}</script>
1、进程管理:在NET Compact Framework里进程管理的函数相对要比net Framework里要简化,不过仍然可以比较好的控制程序进程。
A.启动进程:在启动进程后返回进程的id
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->/// <summary></summary>
/// 启动进程
///
/// <param name="fileName">启动文件的目录路径
/// <returns></returns>返回启动进程的进程ID
public static int StartProcess(string fileName)
{
int progressID = 0;
try
{
//这个目录是动态的
progressID = System.Diagnostics.Process.Start(fileName).Id;
return progressID;
}
catch //(Exception ex)
{
//throw ex;
return 0;
}
}
B.获取当前进程的ID
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->/// <summary></summary>
/// 获取当前进程ID
///
public static int GetCurrentProcessID()
{
Process currentProcess = Process.GetCurrentProcess();
int CurrentProcessID = currentProcess.Id;
return CurrentProcessID;
}
C.终止当前进程
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->/// <summary></summary>
/// 终止当前进程
///
public static void KillCurrentProcess()
{
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
D.通过进程ID来终止进程
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->/// <summary></summary>
/// 终止进程
///
/// <param name="progressID">进程ID
/// <returns></returns>true 表示终止成功,反之表示失败
public static bool KillProcess(int progressID)
{
try
{
System.Diagnostics.Process.GetProcessById(progressID).Kill();
return true;
}
catch //(Exception ex)
{
//throw ex;
return false;
}
}
2、窗体管理。在NET Compact Framework(2.0)的窗体类(System.Windows.Forms.Form))虽然提供WindowsState属性,这个属性是 FormWindowState 枚举类型,在枚举中只有Normal 和 Maximized,不过不能通过Maximized来控制窗体最小,同时也无法控制窗体的关闭。要是实现关闭和最小化只能通过调用api来实现。下面是有关代码:
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->[DllImport("coredll.dll")]
private extern static bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("coredll.dll")]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
///最小化窗体
public static void WindowsMin(string frmTextName)
{
IntPtr hwnd = FindWindow(null, frmTextName);
ShowWindow(hwnd, 6);
}
///隐藏窗体
public static void WindowHide(string frmTextName)
{
IntPtr hwnd = FindWindow(null, frmTextName);
ShowWindow(hwnd, 0);
}
3、重启和关闭操作系统。同样是调用api来完成。
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
[DllImport("Aygshell.dll")]
static extern bool ExitWindowsEx(uint uFlags, int dwReserved);
private const uint EWX_REBOOT = 2;
private const uint EWX_POWEROFF = 8;
///重启操作系统
public static void RootWindows()
{
ExitWindowsEx(EWX_REBOOT, 0);
}
///关闭操作系统
public static void ShutDownWindows()
{
ExitWindowsEx(EWX_POWEROFF, 0);
}
以上代码的运行环境和开发环境:windows mobile5.0 +ppc sdk +vs2005
本文首发地址:http://www.watch-life.net/windows-mobile/process-window-form-system-manager.html
-------------------------------------------
更多文章见:守望轩[http://www.watch-life.net]
分享到:
相关推荐
Windows Mobile 5.0 仿真器是一款用于开发者和测试人员的工具,它允许用户在桌面计算机上模拟运行 Windows Mobile 5.0 操作系统的设备。这个仿真器对于开发、调试和测试移动应用至关重要,因为它提供了在真实设备上...
Windows Mobile 5.0是微软在移动设备操作系统领域的一个重要版本,它为开发者提供了一个强大的平台来构建各种手机应用程序。这个压缩包包含了三十几个经典软件的开发源码,对于想要深入学习Windows Mobile 5.0应用...
- **定义**:Windows Mobile 5.0 SDK是微软提供的一个工具集,用于帮助开发者创建、调试和测试Windows Mobile 5.0操作系统上的应用程序。 - **功能**:该SDK包含了各种API文档、示例代码、开发工具以及模拟器等,...
Windows Mobile 5.0 是微软在2006年推出的一款移动操作系统,主要应用于智能手机和平板电脑。这个系统是基于Windows CE内核的,并且在功能和用户体验上做了很多优化,为开发者提供了丰富的API和工具来开发应用程序。...
Windows Mobile 5.0是微软针对掌上设备推出的一个操作系统版本,旨在提供与桌面版Windows相似的用户体验,同时优化了性能和电池管理,使其更适合移动设备。 本教程的核心知识点涵盖了以下几个方面: 1. **环境搭建...
在移动设备领域,Windows Mobile 5.0是一个重要的操作系统,为开发者提供了丰富的API和工具来构建功能丰富的应用程序。本文将深入探讨如何在Windows Mobile 5.0平台上开发GPS应用程序,特别是针对初学者,通过Visual...
Windows Mobile 5.0 Final Release Documentation Windows Mobile 5.0 开发文档最终版,--2007/2
在Windows Mobile 5.0操作系统中,开发人员可以利用API接口来调用手机的内置摄像头功能,以便实现拍照、录像等应用。这个过程涉及到多个关键知识点,包括API接口的使用、设备驱动交互以及图像处理。 首先,Windows ...
升级windows mobile 5.0
Windows Mobile 5.0模拟器是开发者和爱好者用于测试和体验在Windows Mobile 5.0操作系统上运行的应用程序和功能的工具。这个压缩包包含了Windows Mobile 5.0的模拟环境,以.bin文件格式存储,这通常是二进制数据文件...
这些驱动使得SMDK2440上的硬件组件能够被Windows Mobile 5.0操作系统正确地识别和操作。 **Support Camera:** 描述中提到的支持摄像头意味着该BSP包含了处理图像传感器和摄像头功能的驱动程序。这使得开发人员能够...
为了增强系统的稳定性和安全性,Windows Mobile 5.0提供了`ExitWindowsEx`函数用于重启设备,以及`QueryPolicy`函数用于查询设备的安全策略。 #### 获取设备唯一标识(GetDeviceUniqueID) 最后,为了便于识别不同...
Windows Mobile 5.0是微软为掌上设备推出的操作系统,广泛应用于智能手机和平板电脑,尤其是企业级应用。该操作系统基于Windows CE(Windows Embedded Compact,即Windows CE的后续版本Windows Embedded CE 6.0,也...
《Windows Mobile 5.0用户界面实战》是针对微软在移动设备操作系统上的一款经典版本——Windows Mobile 5.0的用户界面设计与开发的实践教程。这个教程包含了丰富的学习资源,如PPT演示文稿、视频教程以及相关文档,...
车主宝典软件是为城市车主用户量身订做的一套基于手机平台运行的优秀手机客户端软件。 集实时路况、消费打折、资讯浏览、互动娱乐、便民查询、汽车知识为一体的服务于广大车主用户的综合性服务平台产品。...
在移动计算领域,Windows Mobile 5.0曾是广泛使用的操作系统之一,尤其在早期的智能手机和平板电脑上。开发者利用各种编程语言,包括C#,为这个平台创建了许多应用程序。本项目是一个基于C#开发的计算器应用,专为...
在移动设备领域,Windows Mobile 5.0 是微软推出的一款操作系统,主要针对智能手机和平板电脑。这个系统提供了丰富的功能和接口,使得开发者可以构建各种应用,其中之一就是指南针应用程序。"WindowsMobile5.0指南针...
在Windows Mobile 5.0中,开发者们迎来了许多新的特性和改进,这些更新极大地扩展了移动应用程序的开发可能性。以下是一些关键的开发新特性详细解释: 1. **Managed Device API (MDAPI)**:MDAPI是.NET Compact ...
在Windows Mobile 5.0操作系统中,图像处理技术是一个关键的组成部分,特别是在移动设备上,它使得用户可以方便地拍摄、编辑和分享照片。本文将深入探讨Windows Mobile 5.0中的图像操作,包括基本的图像加载、显示、...
Windows Mobile 5.0 Final Release Documentation Windows Mobile 5.0 开发文档最终版,--2007/2