当我将任何 Windows Mobile 连接到我的 PC 时如何运行任何程序?
在 Windows-XP 中,如果我在注册表中更改此设置 - 当我将任何设备
(例如 Windows-Mobile)连接到我的 PC 时,我选择的程序 (GetData.exe) 将运行。
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services\AutoStartOnConnect]
"AutoRun"="d:\\MyTest\\GetData.exe"
但在 windows-7 中它不起作用
谢谢
in Windows-XP if i change this in the registry - when i connect any device
(windows-mobile for example) to my PC the program that i pick (GetData.exe) will run.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services\AutoStartOnConnect]
"AutoRun"="d:\\MyTest\\GetData.exe"
but in windows-7 it dose not work
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您在一些设备上使用它,您可能需要使用 autorun.inf,它驻留在设备的根目录中(如 Windows 所示)并使用如下格式:
[自动运行]
open=Filename.exe
icon=Filename.exe,1
(取自 http://msdn.microsoft.com /en-us/library/cc144206(v=VS.85).aspx )
有关 autorun.inf 的更多信息,请访问:http ://msdn.microsoft.com/en-us/library/cc144200(v=VS.85).aspx
如果您的目标是使程序无论连接的设备如何(USB 闪存驱动器、外部硬盘驱动器、将光盘放入 CDROM、连接电话或类似设备等),看来您最好找到一个程序来执行此操作或编写自己的程序。 AutoPlay/AutoRun是一个事件系统,针对不同场景有特定的触发器。 http://msdn.microsoft.com/en-us/library/aa468474.aspx (自动播放根据设备的内容了解要发送/触发/引发的事件。)
此外,“Windows 移动”非常具体,而“任何设备”则不然。 http://msdn.microsoft.com/en-us/library/ms861759.aspx 被引用为“当基于 Windows CE 的设备连接时 [...]”(所示示例的一部分),这使我相信此注册表项仅适用于运行 WinCE 的设备。
编辑:您也可以指定或编码您自己的事件处理程序,尽管这超出了我的知识范围,所以我不能说更多。 :)
If you're using this for a few devices, you may want to use autorun.inf which resides in the root of the device (as seen by windows) and uses a format such as:
[autorun]
open=Filename.exe
icon=Filename.exe,1
(taken from http://msdn.microsoft.com/en-us/library/cc144206(v=VS.85).aspx )
More information on autorun.inf can be found here: http://msdn.microsoft.com/en-us/library/cc144200(v=VS.85).aspx
If you're aiming to enable a program to run regardless of the device connected (USB flash drive, external hard drive, putting a disc in the CDROM, connecting a phone or similar device, etc), it seems like you may be better off finding a program to do this or writing your own. AutoPlay/AutoRun is an event system that has specific triggers for different scenarios. http://msdn.microsoft.com/en-us/library/aa468474.aspx (Autoplay learns what event to send/trigger/raise based on the content of the device.)
Also, "Windows-mobile" is very specific, whereas "any device" is not. http://msdn.microsoft.com/en-us/library/ms861759.aspx is quoted as saying "When the Windows CE-based device is connected [...]" (part of the example shown), which leads me to believe that this registry key is only functional for a device running WinCE.
edit: You may also be able to specify or code your own eventhandlers, though that is outside the scope of my knowledge so I can't say any more than that. :)