10-21-2016, 11:24 AM
Gintaras, i want to extend the setaudiovolume function of QM.
I want to get all available devices, but i can't do the last step (get the name).
If you could help, thanks
Macro Macro1
i don't get the device name as expected, and get this in QM outpu:
why?
PS: trying to adapt from this
https://msdn.microsoft.com/en-us/librar ... 12(v=vs.85).aspx
I want to get all available devices, but i can't do the last step (get the name).
If you could help, thanks
Macro Macro1
#opt nowarnings 1
IMMDeviceCollection ppDevices
int dwStateMask
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
int stgmAccess
PROPERTYKEY pk
pk.pid=6
GUID t=pk.fmtid
IMMDeviceEnumerator en
IPropertyStore pProps
word w
VARIANT v
PROPVARIANT pActivationParams
IMMDevice de
IAudioEndpointVolume av
en._create(CLSID_MMDeviceEnumerator)
en.GetDefaultAudioEndpoint(eRender eMultimedia &de)
en.EnumAudioEndpoints(eRender DEVICE_STATEMASK_ALL &ppDevices)
ppDevices.GetCount(_i)
for int'u 0 _i
,ppDevices.Item(u &de)
,de.OpenPropertyStore(stgmAccess &pProps)
,pProps.GetAt(u &pk)
,pProps.GetValue(&pk +&v)
,pProps.Commit
,_s.FromGUID(pk.fmtid)
,;out _s
,;out pk.pid
,out pActivationParams.pbstrVal
i don't get the device name as expected, and get this in QM outpu:
why?
PS: trying to adapt from this
https://msdn.microsoft.com/en-us/librar ... 12(v=vs.85).aspx