开发者

how to run any program when i connect any windows-mobile to my PC?

开发者 https://www.devze.com 2023-01-30 08:15 出处:网络
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.

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


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. :)

0

精彩评论

暂无评论...
验证码 换一张
取 消