How do I detect when a removable disk is inserted using C#?

前端 未结 3 1026
夕颜
夕颜 2020-12-05 05:23

I\'m just concerned about Windows, so there\'s no need to go into esoterica about Mono compatibility or anything like that.

I should also add that the app that I\'m

3条回答
  •  我在风中等你
    2020-12-05 06:09

    The simplest way would be to create an Autoplay Handler:

    http://www.codeproject.com/KB/system/AutoplayDemo.aspx

    Autoplay Version 2 is a feature in Windows XP that will scan the first four levels of a removable media, when it arrives, looking for media content types (music, graphics, or video). Registration of applications is done on a content type basis. When a removable media arrives, Windows XP determines what actions to perform by evaluating the content and comparing it to registered handlers for that content.

    A detailed MSDN article is also available.

提交回复
热议问题