Mirror

Detect whether there is a sound card installed (Views: 100)


Problem/Question/Abstract:

Detect whether there is a sound card installed

Answer:

Solve 1:

If you need to detect whether there is a sound card installed, your application may call the function 'waveOutGetNumDevs' from the multimedia DLL (winmm.dll, part of a standard installation).

// declare by a nicer functionname..

function SoundCardInstalled: longint; stdcall;
  external 'winmm.dll' name 'waveOutGetNumDevs';

// use like this..

if SoundCardInstalled > 0 then
  Showmessage('A sound card was found.');


Solve 2:

Add MMSystem in the uses of your form

procedure TForm1.Button1Click(Sender: TObject);
begin
  if waveOutGetNumDevs > 0 then
    ShowMessage('Hay tarjeta de sonido instalada' +
      #13 +
      'There is a soundcard installed')
  else
    ShowMessage('No Hay tarjeta de sonido instalada' + #13 +
      #13 +
      'There is not a soundcard installed');
end;

<< Back to main page