10-21-2016, 02:49 PM
1. In C++ need only #include <devpkey.h> and maybe add some library. And install Windows SDK. In QM need to find DEVPKEY_Device_FriendlyName definition in devpkey.h and convert to QM. Attached devpkey.h from Win10 SDK. In PROPERTYKEY definition we see that it consists of GUID and int. One of ways to fill a GUID is memcpy uuidof.
yes, i messed to format properly in GUID format
2. QM _create is a shorter way to call CoCreateInstance. The MSDN example uses CoCreateInstance only for pEnumerator.
OK
3. C++ LPWSTR in QM is word*. It is a raw Unicode string (just pointer).
Hmm, how was I to know..i lost an incredible time with this.....read 10x times documentation.
4. Converts from Unicode UTF16 to QM string format, probably UTF8.
in MSDN
IPropertyStore::GetValue method
Gets data for a specific property.
Syntax
C++
HRESULT GetValue(
[in] REFPROPERTYKEY key,
[out] PROPVARIANT *pv
);
how did you find that pwszVal was the one to pickup? (aside the fact you're az master in programming)
5. STGM_READ is not declared, but valid in macro. But I must declare
def DEVICE_STATE_ACTIVE 0x00000001
def DEVICE_STATE_DISABLED 0x00000002
def DEVICE_STATE_NOTPRESENT 0x00000004
def DEVICE_STATE_UNPLUGGED 0x00000008
def DEVICE_STATEMASK_ALL 0x0000000F
to have function working, and don't understand why.
yes, i messed to format properly in GUID format
2. QM _create is a shorter way to call CoCreateInstance. The MSDN example uses CoCreateInstance only for pEnumerator.
OK
3. C++ LPWSTR in QM is word*. It is a raw Unicode string (just pointer).
Hmm, how was I to know..i lost an incredible time with this.....read 10x times documentation.
4. Converts from Unicode UTF16 to QM string format, probably UTF8.
in MSDN
IPropertyStore::GetValue method
Gets data for a specific property.
Syntax
C++
HRESULT GetValue(
[in] REFPROPERTYKEY key,
[out] PROPVARIANT *pv
);
how did you find that pwszVal was the one to pickup? (aside the fact you're az master in programming)
5. STGM_READ is not declared, but valid in macro. But I must declare
def DEVICE_STATE_ACTIVE 0x00000001
def DEVICE_STATE_DISABLED 0x00000002
def DEVICE_STATE_NOTPRESENT 0x00000004
def DEVICE_STATE_UNPLUGGED 0x00000008
def DEVICE_STATEMASK_ALL 0x0000000F
to have function working, and don't understand why.