hr := obj.EnumPartsOutgoing(ppParts);
if hr <> ERROR_SUCCESS then Exit;
hr := ppParts.GetCount(pCount);
if hr <> ERROR_SUCCESS then Exit;
hr := ppParts.GetPart(0, ppPart);
if hr <> ERROR_SUCCESS then Exit;
//***************************************************************
hr := ppPart.GetName(ppwstrName);
if hr <> ERROR_SUCCESS then Exit
else
begin
listbox1.Items.Add('ppPart.GetName: '+ ppwstrName);
if (ppwstrName = '麦克风加强') or (ppwstrName = 'microphone boost') then
begin
hr := ppPart.Activate(CLSCTX_ALL, IAudioVolumeLevel, ppVolumeLevel);
if hr <> ERROR_SUCCESS then Exit;
hr := ppVolumeLevel.GetLevel(0, fValue); //fValue = 0-30
if hr <> ERROR_SUCCESS then Exit;
listbox1.Items.Add('Oringinal MicrophoneBoostVolumeLevel: '+floattostr(fValue));
end;
if hr <> ERROR_SUCCESS then Exit;
hr := ppParts.GetCount(pCount);
if hr <> ERROR_SUCCESS then Exit;
hr := ppParts.GetPart(0, ppPart);
if hr <> ERROR_SUCCESS then Exit;
//***************************************************************
hr := ppPart.GetName(ppwstrName);
if hr <> ERROR_SUCCESS then Exit
else
begin
listbox1.Items.Add('ppPart.GetName: '+ ppwstrName);
if (ppwstrName = '麦克风加强') or (ppwstrName = 'microphone boost') then
begin
hr := ppPart.Activate(CLSCTX_ALL, IAudioVolumeLevel, ppVolumeLevel);
if hr <> ERROR_SUCCESS then Exit;
hr := ppVolumeLevel.GetLevel(0, fValue); //fValue = 0-30
if hr <> ERROR_SUCCESS then Exit;
listbox1.Items.Add('Oringinal MicrophoneBoostVolumeLevel: '+floattostr(fValue));
end;
end;
其它代码可参阅相关C程序:http://blog.csdn.net/suixinger1/article/details/44117721