2008. november 5., szerda
How to detect a sound device
Problem/Question/Abstract:
Is there a way to detect a sound device (personally, I want to detect a sound card) to know if such a device is present on the computer my application is running?
Answer:
Solve 1:
{ ... }
if WaveOutGetNumDevs > 0 then
ShowMessage('Wave-Device present')
else
ShowMessage('No Wave-Device present');
{ ... }
Solve 2:
function IsSoundCardInstalled: Boolean;
type
SCFunc = function: UInt; stdcall;
var
LibInst: LongInt;
EntryPoint: SCFunc;
begin
Result := False;
LibInst := LoadLibrary(PChar('winmm.dll'));
try
if LibInst <> 0 then
begin
EntryPoint := GetProcAddress(LibInst, 'waveOutGetNumDevs');
if (EntryPoint <> 0) then
Result := True;
end;
finally
if (LibInst <> 0) then
FreeLibrary(LibInst);
end;
end;
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése