Determine WPD device type in Delphi

前端 未结 2 1496
粉色の甜心
粉色の甜心 2021-01-27 08:28

I\'m trying to determine what type my WPD device is in Delphi.

In my application I need to know if the device is a Phone or Camera or what ever it is.

According

2条回答
  •  清歌不尽
    2021-01-27 08:34

    Ok, so eventually I figured out how to read the device type of a device.

    What needed to be done was to read the device properties.

    Some very interesting information could be read, such as the battery level of the device, if available.

    EDIT: I used the source found here as a reference to WPD programming.

    Code tested with external harddrives, SD memory card reader, USB sticks, Apple iPhone, and Samsung Galaxy phone.

    Code is available HERE!!!

    Just copy and paste the code in to a new VCL project, add a listbox called DeviceList, a memo called LogMemo, a panel called Panel1, and a button inside Panel1 called Button1. Then doubleclick on the Listbox, and doubleclick on the button, and finally doubleclick on the main form, and everything should run flawlsessly.

    Programmed in Delphi XE7.

提交回复
热议问题