5
57605993
Unregistered / Unconfirmed
GUEST, unregistred user!
晚上查了很多资料,没有一个成功,刚刚接触DELPHI不久,水平有限。
很多不懂问题。资源文件做法也是照搬网上的方法:xhh wave "login.wav"
保存的文件名是xh.rc,编译成资源文件是xh.res
代码如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,mmsystem, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{$R xh.res}
procedure TForm1.Button1Click(Sender: TObject);
var
Res:TResourceStream;
begin
Res:=TResourceStream.Create(0,'xhh','wav');
Res.SaveToFile('xh.wav');
playsound('xhh',hinstance,snd_async);
Res.Free;
end;
end.
很多不懂问题。资源文件做法也是照搬网上的方法:xhh wave "login.wav"
保存的文件名是xh.rc,编译成资源文件是xh.res
代码如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,mmsystem, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{$R xh.res}
procedure TForm1.Button1Click(Sender: TObject);
var
Res:TResourceStream;
begin
Res:=TResourceStream.Create(0,'xhh','wav');
Res.SaveToFile('xh.wav');
playsound('xhh',hinstance,snd_async);
Res.Free;
end;
end.