0

I want to create an application that automatically runs after I insert a smartphone ( portable device ) into a computer. I has a big problem in creating an event handler to run my application. Can anyone help me on how I can do it on C# or registry of windows?

demongolem
  • 9,474
  • 36
  • 90
  • 105
Thong Lee
  • 41
  • 3
  • You could check my answer on a similiar topic. see [Get USB Device on insertion](http://stackoverflow.com/questions/6642633/wmi-get-usb-device-description-on-insertion/6643234#6643234). You could check if your mobile has been connected and afterwards run some code! – Pilgerstorfer Franz Feb 28 '14 at 21:58

1 Answers1

2

solved

64 bit :

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\Test Device]
"Action"="Import pictures"
"DefaultIcon"="C:\\Test Devices\\Resource\\icon.ico,0"
"Provider"="Test Devices"
"InitCmdLine"="C:\\Test Devices\\AutoPlay.exe"
"ProgID"="Shell.HWEventHandlerShellExecute"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\WPD\Source\{80E170D2-1055-4A3E-B952-82CC4F8A8689}]
"Test Device"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\WPD\VideoSource]
"Test Device"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\WPD\ImageSource]
"Test Device"=""

32 bit :

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\Test Device]
"Action"="Import pictures"
"DefaultIcon"="C:\\Test Devices\\Resource\\icon.ico,0"
"Provider"="Test Devices"
"InitCmdLine"="C:\\Test Devices\\AutoPlay.exe"
"ProgID"="Shell.HWEventHandlerShellExecute"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\WPD\Source\{80E170D2-1055-4A3E-B952-82CC4F8A8689}]
"Test Device"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\WPD\VideoSource]
"Test Device"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\WPD\ImageSource]
"Test Device"=""
Thong Lee
  • 41
  • 3