Multimedia Delphi

// note: DevicesNames must be created before calling this procedure
uses mmsystem;
procedure GetWaveOutDevices(DeviceNames: TStrings);
var
DNum: Integer;
i: Integer;
Caps: TWaveOutCapsA;
begin
DNum := waveOutGetNumDevs; // Number of Devices
for i := 0 to DNum - 1 do // Query Devicenames
begin
waveOutGetDevCaps(i, @Caps, SizeOf(TWaveOutCapsA));
DeviceNames.Add(string(Caps.szPname));
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
GetWaveOutDevices(Listbox1.Items);
end;