I am developing a mobile application for Windows Mobile. I would like that the application is lauched by default by the system at startup and that users cannot minimize it.
我正在为Windows Mobile开发移动应用程序。我希望系统在启动时默认启动应用程序,并且用户不能将其最小化。
So only this application is available, all other features are disabled.
因此,只有此应用程序可用,所有其他功能都被禁用。
I m sure that I could define a launcher, which is executed at startup. But some problems come into my mind: could there be some memory optimizations ? I mean, because only one application is available and used, maybe some other programs could be disabled, which could allow less memory to be used ?
我确信我可以定义一个启动时执行的启动器。但是我想到了一些问题:是否会有一些内存优化?我的意思是,因为只有一个应用程序可用和使用,可能会禁用其他一些程序,这可能会允许使用更少的内存?
Do you have any links to this purpose ?
你有这个目的的链接吗?
EDIT: Thanks for your answers. I read your links about the kiosk mode and found another very interesting post about this subject: this blog
编辑:谢谢你的回答。我阅读了有关自助服务终端模式的链接,并发现了另一个关于此主题的非常有趣的帖子:此博客
It says that for kiosk mode applications, it seems to be better on the long run to use Windows CE instead of Windows mobile, because the former is easier to adapt to these needs.
它说对于自助服务终端模式应用程序,从长远来看,使用Windows CE而不是Windows移动设备似乎更好,因为前者更容易适应这些需求。
3 个解决方案
#1
Might be able to post more useful stuff later on, but for now I can tell you the term you want to search Google for is: "kiosk mode".
可能会在以后发布更多有用的东西,但是现在我可以告诉你你要搜索Google的术语是:“kiosk模式”。
Update - Useful stuff (hopefully)
更新 - 有用的东西(希望)
Now to be frank any kiosk mode is more or less a hack. Windows Mobile isn't designed for it and as you get into more and more edge cases you are going to find the odd gap, however for the purpose of most programs the following is sufficient:
现在坦白说任何一个售货亭模式或多或少是一个黑客。 Windows Mobile不是为它设计的,当你遇到越来越多的边缘情况时,你会发现奇怪的差距,但是对于大多数程序来说,以下就足够了:
Task 1 - Cover the UI and the taskbar so that it can't be accessed:
任务1 - 覆盖UI和任务栏,以便无法访问它:
On your main form set the WindowState to Maximized and FormBorderStyle to None. On older OSes you might need to actually disable the taskbar itself and move the form over the top of it. This is achieved by PInvoking:
在主窗体上将WindowState设置为Maximized,将FormBorderStyle设置为None。在较旧的操作系统上,您可能需要实际禁用任务栏本身并将表单移到其顶部。这是通过PInvoking实现的:
FindWindow with the argument "HHTaskBar" (this may depend on platform, HHTaskbar works for Pocket PC 2003) and String.Empty
带有参数“HHTaskBar”的FindWindow(这可能取决于平台,HHTaskbar适用于Pocket PC 2003)和String.Empty
[DllImport("coredll.dll", EntryPoint="FindWindowW", SetLastError=true)]
private static extern IntPtr FindWindowCE(string lpClassName, string lpWindowName);
EnableWindow with the IntPtr from FindWindow and false
EnableWindow与FindWindow的IntPtr和false
[DllImport("coredll.dll", SetLastError=true)]
public static extern bool EnableWindow(IntPtr hWnd, bool bEnable);
ShowWindow with the IntPtr from FindWindow and 0 (SW_HIDE)
使用FindWindow的IntPtr和0(SW_HIDE)显示ShowWindow
[DllImport("coredll.dll")]
public static extern bool ShowWindow( IntPtr hwnd, int nCmdShow);
Task 2 - Prevent hard-wired app keys.
任务2 - 防止硬连线的应用程序密钥。
You know the ones, press orange and left button and it will automatically open Pocket Outlook. To do this I'm going to break rank here and recommend the only viable way I know of doing this which is to use an undocumented Win32 API call. It's a perfectly stable call and I have a range of projects running every day that use it I just figure in some future upgrade I might need to modify the code if it gets removed, so bear that in mind.
你知道那些,按橙色和左键,它将自动打开Pocket Outlook。要做到这一点,我将在这里打破排名,并推荐我知道这样做的唯一可行的方法,即使用未记录的Win32 API调用。这是一个非常稳定的调用,我有一系列项目每天运行使用它我只想在未来的升级中我可能需要修改代码,如果它被删除,所以记住这一点。
You'll want to setup a low-level system wide keyboard hook via the PInvoke call:
您需要通过PInvoke调用设置一个低级系统范围的键盘钩子:
[DllImport("coredll.dll")]
private static extern IntPtr SetWindowsHookEx(int idHook, HookHandlerDelegate lpfn, IntPtr hMod, uint dwThreadId);
This is reasonably complex and its probably better just to point to a guide like this one to explain the theory. The basic premise is to discover the keycode of the irritating "special keys" and then block them via the hook (i.e. don't pass them on).
这是相当复杂的,它可能更好只是指向像这样的指南来解释理论。基本前提是发现恼人的“特殊键”的键码,然后通过钩子阻止它们(即不要传递它们)。
If you're working on CF I suggest also digging into OpenNETCF as I believe it already has a global KeyHook inside it.
如果你正在研究CF,我建议也要深入研究OpenNETCF,因为我相信它已经有了一个全局的KeyHook。
As I said before this isn't perfect and IIRC the volume control is not blockable and its possible that a notification such as a new wireless network might intrude upon your kiosk mode if you don't set various flags in the registry (to tell it not to do that :) ).
正如我之前所说,这并不完美,而且IIRC的音量控制是不可阻挡的,如果您没有在注册表中设置各种标志,可能会出现诸如新无线网络之类的通知可能会侵入您的信息亭模式(告诉它不要那样:))。
Still, it's not that much effort and it should be sufficient for most of your apps.
尽管如此,它并没有那么多的努力,它应该足够你的大多数应用程序。
Task 3 - Make your app run from start up
任务3 - 让您的应用程序从启动运行
This is the bit that can differ a fair bit depending on the device. If you want to stay in managed code the issue is that the NETCF doesn't come pre-installed on some devices. In most cases you can just write an unmanaged booter that sits in the autorun directory (there should be one, check the manufacturer's docs), and installs .NETCF, your app(s) and then runs your app(s). If you don't want to get your hands dirty with unmanaged code then most hardware manufacturers offer some kind of scripting system to setup a device as you see fit. However these may work with varying degrees of effectiveness.
根据器件的不同,这个位可能会有所不同。如果您希望保留托管代码,则问题是NETCF未预先安装在某些设备上。在大多数情况下,您可以编写一个位于自动运行目录中的非托管引导程序(应该有一个,检查制造商的文档),然后安装.NETCF,您的应用程序,然后运行您的应用程序。如果你不想弄脏非托管代码,那么大多数硬件制造商会提供某种脚本系统来设置你认为合适的设备。然而,这些可能会有不同程度的有效性。
#2
You want to run your device in "Kiosk Mode". Actually, Windows Mobile devices aren't intended to run in kiosk mode. If you can select the device you are going to use, select a Windows CE device, for which you can modify the image. Windows CE devices do have an option to run in a kiosk mode. This is the best solution, however you need Platform Builder and a device that an image can be downloaded to.
您想以“Kiosk模式”运行您的设备。实际上,Windows Mobile设备无意在自助服务终端模式下运行。如果您可以选择要使用的设备,请选择可以修改图像的Windows CE设备。 Windows CE设备可以选择在Kiosk模式下运行。这是最好的解决方案,但是您需要Platform Builder和可以下载图像的设备。
For a Windows Mobile, you can "simulate" kiosk mode. This is what you need to do:
对于Windows Mobile,您可以“模拟”自助服务终端模式。这是你需要做的:
- Launch your application at start up.
- Make your application full screen. The taskbar should be hidden.
- Intercept hardware buttons that can navigate you away from your application
- If other programs run on start up, disable them. Usually programs not launch on start up, so you shouldn't worry about this.
在启动时启动您的应用程序。
使您的应用程序全屏。应该隐藏任务栏。
拦截可以导航您离开应用程序的硬件按钮
如果其他程序在启动时运行,请禁用它们。通常程序在启动时不启动,因此您不必担心这一点。
This article could be a starting point. I believe that it will be difficult or even impossible to implement a generic solution. Instead focus on a single device.
这篇文章可能是一个起点。我认为实施通用解决方案很困难甚至不可能。而是专注于单个设备。
#3
Here is an article on CodeProject that talks about putting a device into Kiosk mode.
这是一篇关于CodeProject的文章,讨论如何将设备置于Kiosk模式。
This is at least a starter for you, but be sure to notice the warnings listed in the article about what devices the sample will work on!
这对您来说至少是一个启动器,但请务必注意文章中列出的有关样本将起作用的设备的警告!
#1
Might be able to post more useful stuff later on, but for now I can tell you the term you want to search Google for is: "kiosk mode".
可能会在以后发布更多有用的东西,但是现在我可以告诉你你要搜索Google的术语是:“kiosk模式”。
Update - Useful stuff (hopefully)
更新 - 有用的东西(希望)
Now to be frank any kiosk mode is more or less a hack. Windows Mobile isn't designed for it and as you get into more and more edge cases you are going to find the odd gap, however for the purpose of most programs the following is sufficient:
现在坦白说任何一个售货亭模式或多或少是一个黑客。 Windows Mobile不是为它设计的,当你遇到越来越多的边缘情况时,你会发现奇怪的差距,但是对于大多数程序来说,以下就足够了:
Task 1 - Cover the UI and the taskbar so that it can't be accessed:
任务1 - 覆盖UI和任务栏,以便无法访问它:
On your main form set the WindowState to Maximized and FormBorderStyle to None. On older OSes you might need to actually disable the taskbar itself and move the form over the top of it. This is achieved by PInvoking:
在主窗体上将WindowState设置为Maximized,将FormBorderStyle设置为None。在较旧的操作系统上,您可能需要实际禁用任务栏本身并将表单移到其顶部。这是通过PInvoking实现的:
FindWindow with the argument "HHTaskBar" (this may depend on platform, HHTaskbar works for Pocket PC 2003) and String.Empty
带有参数“HHTaskBar”的FindWindow(这可能取决于平台,HHTaskbar适用于Pocket PC 2003)和String.Empty
[DllImport("coredll.dll", EntryPoint="FindWindowW", SetLastError=true)]
private static extern IntPtr FindWindowCE(string lpClassName, string lpWindowName);
EnableWindow with the IntPtr from FindWindow and false
EnableWindow与FindWindow的IntPtr和false
[DllImport("coredll.dll", SetLastError=true)]
public static extern bool EnableWindow(IntPtr hWnd, bool bEnable);
ShowWindow with the IntPtr from FindWindow and 0 (SW_HIDE)
使用FindWindow的IntPtr和0(SW_HIDE)显示ShowWindow
[DllImport("coredll.dll")]
public static extern bool ShowWindow( IntPtr hwnd, int nCmdShow);
Task 2 - Prevent hard-wired app keys.
任务2 - 防止硬连线的应用程序密钥。
You know the ones, press orange and left button and it will automatically open Pocket Outlook. To do this I'm going to break rank here and recommend the only viable way I know of doing this which is to use an undocumented Win32 API call. It's a perfectly stable call and I have a range of projects running every day that use it I just figure in some future upgrade I might need to modify the code if it gets removed, so bear that in mind.
你知道那些,按橙色和左键,它将自动打开Pocket Outlook。要做到这一点,我将在这里打破排名,并推荐我知道这样做的唯一可行的方法,即使用未记录的Win32 API调用。这是一个非常稳定的调用,我有一系列项目每天运行使用它我只想在未来的升级中我可能需要修改代码,如果它被删除,所以记住这一点。
You'll want to setup a low-level system wide keyboard hook via the PInvoke call:
您需要通过PInvoke调用设置一个低级系统范围的键盘钩子:
[DllImport("coredll.dll")]
private static extern IntPtr SetWindowsHookEx(int idHook, HookHandlerDelegate lpfn, IntPtr hMod, uint dwThreadId);
This is reasonably complex and its probably better just to point to a guide like this one to explain the theory. The basic premise is to discover the keycode of the irritating "special keys" and then block them via the hook (i.e. don't pass them on).
这是相当复杂的,它可能更好只是指向像这样的指南来解释理论。基本前提是发现恼人的“特殊键”的键码,然后通过钩子阻止它们(即不要传递它们)。
If you're working on CF I suggest also digging into OpenNETCF as I believe it already has a global KeyHook inside it.
如果你正在研究CF,我建议也要深入研究OpenNETCF,因为我相信它已经有了一个全局的KeyHook。
As I said before this isn't perfect and IIRC the volume control is not blockable and its possible that a notification such as a new wireless network might intrude upon your kiosk mode if you don't set various flags in the registry (to tell it not to do that :) ).
正如我之前所说,这并不完美,而且IIRC的音量控制是不可阻挡的,如果您没有在注册表中设置各种标志,可能会出现诸如新无线网络之类的通知可能会侵入您的信息亭模式(告诉它不要那样:))。
Still, it's not that much effort and it should be sufficient for most of your apps.
尽管如此,它并没有那么多的努力,它应该足够你的大多数应用程序。
Task 3 - Make your app run from start up
任务3 - 让您的应用程序从启动运行
This is the bit that can differ a fair bit depending on the device. If you want to stay in managed code the issue is that the NETCF doesn't come pre-installed on some devices. In most cases you can just write an unmanaged booter that sits in the autorun directory (there should be one, check the manufacturer's docs), and installs .NETCF, your app(s) and then runs your app(s). If you don't want to get your hands dirty with unmanaged code then most hardware manufacturers offer some kind of scripting system to setup a device as you see fit. However these may work with varying degrees of effectiveness.
根据器件的不同,这个位可能会有所不同。如果您希望保留托管代码,则问题是NETCF未预先安装在某些设备上。在大多数情况下,您可以编写一个位于自动运行目录中的非托管引导程序(应该有一个,检查制造商的文档),然后安装.NETCF,您的应用程序,然后运行您的应用程序。如果你不想弄脏非托管代码,那么大多数硬件制造商会提供某种脚本系统来设置你认为合适的设备。然而,这些可能会有不同程度的有效性。
#2
You want to run your device in "Kiosk Mode". Actually, Windows Mobile devices aren't intended to run in kiosk mode. If you can select the device you are going to use, select a Windows CE device, for which you can modify the image. Windows CE devices do have an option to run in a kiosk mode. This is the best solution, however you need Platform Builder and a device that an image can be downloaded to.
您想以“Kiosk模式”运行您的设备。实际上,Windows Mobile设备无意在自助服务终端模式下运行。如果您可以选择要使用的设备,请选择可以修改图像的Windows CE设备。 Windows CE设备可以选择在Kiosk模式下运行。这是最好的解决方案,但是您需要Platform Builder和可以下载图像的设备。
For a Windows Mobile, you can "simulate" kiosk mode. This is what you need to do:
对于Windows Mobile,您可以“模拟”自助服务终端模式。这是你需要做的:
- Launch your application at start up.
- Make your application full screen. The taskbar should be hidden.
- Intercept hardware buttons that can navigate you away from your application
- If other programs run on start up, disable them. Usually programs not launch on start up, so you shouldn't worry about this.
在启动时启动您的应用程序。
使您的应用程序全屏。应该隐藏任务栏。
拦截可以导航您离开应用程序的硬件按钮
如果其他程序在启动时运行,请禁用它们。通常程序在启动时不启动,因此您不必担心这一点。
This article could be a starting point. I believe that it will be difficult or even impossible to implement a generic solution. Instead focus on a single device.
这篇文章可能是一个起点。我认为实施通用解决方案很困难甚至不可能。而是专注于单个设备。
#3
Here is an article on CodeProject that talks about putting a device into Kiosk mode.
这是一篇关于CodeProject的文章,讨论如何将设备置于Kiosk模式。
This is at least a starter for you, but be sure to notice the warnings listed in the article about what devices the sample will work on!
这对您来说至少是一个启动器,但请务必注意文章中列出的有关样本将起作用的设备的警告!