正文

Customizing the Windows CE .NET User Int2010-01-19 16:19:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/liyutai/50590.html

分享到:

定制shells

The Explorer shell provided with Platform Builder is a good general-purpose shell that allows users a great deal of flexibility, while maintaining a generally familiar look and feel. Many embedded devices require a more tightly controlled user experience; for example, HMI industrial controllers, self-service Kiosks, or possibly even the control system of the train I'm riding in as I write this. These types of systems require a custom shell that limits the device to a particular function or set of functions it was designed for. Fortunately, Windows CE was designed with this in mind, and allows you to use any application you want as the shell.

Let's look at some of the functionality a custom shell might need:

1.                 在系统启动时运行.

2.                 向用户提供一个界面(接口).

·                                接受用户收入(,并响应).

·                                向用户显示响应.

·                                显示某些操作的当前状态.

3.                 Change modes/Tasks.

在系统启动时运行shell

在系统启动时运行shell是非常简单的,只需要一个 注册表项.The following extract from the registry shows how the standard shell (explorer.exe is loaded):

[HKEY_LOCAL_MACHINE\init]
   "Launch50"="explorer.exe"
   "Depend50"=hex:14,00, 1e,00

内核初始化之后,将扫描Init key  寻找"LaunchXX"形式的key,然后以数字顺序装载列在里面的应用程序.DependXX values specify the XX value of an application loaded by the kernel as binary values in the registry. (The "hex:" syntax is used in REG files for values of type REG_BINARY.) The data for this registry value is a set of DWORD values corresponding to the Launch values of other applications the program depends on.

Note   The data is defined as a sequence of bytes, so you must take into account that the operating system expects the data in little-endian 顺序.

So the example translates to:

运行explorer.exe after whatever application is listed as "Launch20" and the application listed as "Launch30." (These happen to be Device.exe and Gwes.exe.)

这里有一个catch机制.The dependency is designed for operating system dependent services. The device manager and GWES must actually have initialized to a point where they can be used before the shell can start using them. Therefore, the operating system can't just launch the applications randomly. (Well, actually it could, but that would leave each application to create its own mechanism for indicating it was ready for use—creating general havoc for developers the world over.) 幸运的是, the Windows CE architects considered this and created a standard mechanism for indicating that an application is ready for use. Windows CE uses this mechanism to determine when it should launch the dependent applications.任何在Init key下装载的应用程序都必须调用函数SignalStarted(),并把命令行参数转换为一个长整数传进去:

SignalStarted(_wtol(lpCmdLine));

这个调用告诉操作系统:程序已经自身初始化到了可以被其他应用程序放心调用的地方了。

使用浏览器作为shell

Once you have gotten your application to load at boot time in place of the shell, it's time to get busy with the UI coding. Typically, a UI in embedded devices doesn't resemble the traditional Windows application, with its main window and menu, toolbars, status bar, and so on. Instead, an embedded device UI is usually quite visual, and often best created by professional graphics designers. (Most engineers don't even come close to that!) So it's often desirable for the programmer and graphics designer to work together. Such a meeting of minds is proving very successful in Web development and design. Fairly rich, visually pleasing interfaces are generated almost daily on the great WWW. Why not use that model in your embedded system UI design? Windows CE .NET includes a browser component that let's you do just that.

Windows CE .NET下的浏览器组件是Microsoft® Internet Explorer 5.5 浏览器控件桌面版的一个子集. 这个组件是一个Microsoft ActiveX® 控件,可以支持所有 browsing and rendering functionality in one reusable package. 有一个叫做IESAMPLE的样例程序 (一会我们将使用它。)

The IESAMPLE application, which hosts the Internet Explorer browser control, provides a familiar Internet Explorer browser interface complete with menus, toolbars, and status bar. However, as previously mentioned, this isn't desirable in most embedded systems. What we need to have is an application that can use the browser in a "Full Screen" mode. Well it just so happens that the good folks at Microsoft thought of that, too. (Although, they failed to mention it in the documentation!) The IESAMPLE application includes a number of #if tests to enable or disable the menus, status bar, and favorites. So you only need to make a few minor modifications to the build of IESAMPLE to get what you need for a browser-based shell.

Setting Up the Project

//其实在下载下来的程序里,下面改动和设置大部分已经做好了.需要做的我在后面标识

首先, 使用文章顶部的连接下载这个工程的源码IESHELL.exe.

......

更多内容请点击查看原文:http://www.hzlitai.com.cn/article/ARM9-article/system/1751.html

阅读(4322) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册