?? unit1.pas
字號:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, MMSystem;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
procedure PlayResSound(RESName:String;uFlags:Integer);
public
{ Public declarations }
end;
var
Form1: TForm1;
PtrSound : PChar;
hRes : THandle;
implementation
{$R *.DFM}
{$R Sound.res}
procedure TForm1.PlayResSound(RESName:String;uFlags:Integer);
var
hResInfo,hRes:Thandle;
lpGlob:PChar;
begin
hResInfo:=FindResource(HInstance,PChar(RESName),MAKEINTRESOURCE('WAVEFILE'));
if hResInfo = 0 then
begin
messagebox(0,'Could not find this Resource',PChar(RESName),16);
exit;
end;
hRes:=LoadResource(HInstance,hResinfo);
if hRes = 0 then
begin
messagebox(0,'Could not load this Resource',PChar(RESName),16);
exit;
end;
lpGlob:=LockResource(hRes);
if lpGlob=nil then
begin
messagebox(0,'Resource bad.',PChar(RESName),16);
exit;
end;
uFlags:=snd_Memory or uFlags;
SndPlaySound(lpGlob,uFlags);
UnlockResource(hRes);
FreeResource(hRes);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
PlayResSound(ptrSound,snd_async or snd_Memory);
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -