There is a little sample
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
Function PlaySoundW(x1: PWideChar; x2: HMODULE; x3: DWORD): longbool;stdcall; external 'coredll.dll' name 'PlaySoundW';
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
PlaySoundW('\windows\beep.wav',0,0);
end;
initialization
{$I unit1.lrs}
end.