1

How do I detect usb disk availability? When I connect my Android phone to pc, it appears as USB disk but it's not accessible until I tap "Turn on USB storage" on the phone's screen. Is there an event I should use? I know there is a proper way to do so, please advise.

Update: It seems I need to explain: in a case like with my Android phone Windows doesn't send WM_DEVICECHANGE when i turn the phone storage on. Perhaps, it similar to card readers or cdrom - a letter assigned to the drive, but you can't access it until memory card or cd inserted. I want to be notified somehow when this happens. I could use polling of course but it doesn't seem to me very efficient. I'm sure this should be possible because the Windows Explorer does somehow detect the changes.

Alex
  • 57
  • 1
  • 7
  • See [Registering for Device Notification](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363432.aspx) and [Detecting Media Insertion or Removal](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363215.aspx) – Remy Lebeau Jun 15 '17 at 03:26
  • 1
    If a USB thumb drive gets inserted / removed the system sends a ["WM_DEVICECHANGE"](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363480.aspx) message. The problem is -- at least with my Android phone -- that Windows does not send such a message when it becomes available as a storage device in Explorer. – Olaf Hess Jun 15 '17 at 04:11
  • Possible duplicate of [detect usb drive/device using delphi](https://stackoverflow.com/questions/7949782/detect-usb-drive-device-using-delphi) – Jerry Dodge Jun 16 '17 at 00:30

0 Answers0