我用这个函数 PlaySound 提示 “Undeclared identifier: 'PlaySound'” 是不是还要加载某个文件

love800309 2004-11-04 04:46:10
谢谢各位
帮帮忙
...全文
360 8 打赏 收藏 举报
写回复
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
Jute 2004-11-06
  • 打赏
  • 举报
回复
HRESULT PlaySound (
BSTR bstrSound,
OLE_HANDLE hModule,
DWORD dwSound,
DWORD dwId );

bstrSound
BSTR that specifies the sound file to play.
hModule
Handle of the executable file that contains the resource to load.
dwSound
Specifies the flag for playing the sound.
The following values are defined: SND_APPLICATION SND_NODEFAULT
SND_ALIAS SND_NOSTOP
SND_ALIAS_ID SND_NOWAIT
SND_ASYNC SND_PURGE
SND_FILENAME SND_RESOURCE
SND_LOOP SND_SYNC
SND_MEMORY



For more information about these flags, see the documentation for the Windows CE PlaySound function.

dwId
Specifies the bookmark identifier. The parameter is ignored if 0.
Return Values

NOERROR
Indicates success.
E_INVALIDARG
Indicates that the argument is invalid or incompatible.
E_OUTOFMEMORY
The system ran out of memory during processing.
aiirii 2004-11-04
  • 打赏
  • 举报
回复
http://www.latiumsoftware.com/en/delphi/00024.php

uses MMSystem;

procedure TForm1.Button1Click(Sender: TObject);
begin
sndPlaySound('C:\Windows\Media\Tada.wav',
SND_NODEFAULT Or SND_ASYNC Or SND_LOOP);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
sndPlaySound(nil, 0); // Stops the sound
end;
heartwolf 2004-11-04
  • 打赏
  • 举报
回复
在Uses 里面加上MMSystem单元
love800309 2004-11-04
  • 打赏
  • 举报
回复
只能听到“当”的一声
love800309 2004-11-04
  • 打赏
  • 举报
回复
就这样调用

playsound('e:\1.wav',0,SND_ASYNC)
beyondtkl 2004-11-04
  • 打赏
  • 举报
回复
你怎么调用的。。
love800309 2004-11-04
  • 打赏
  • 举报
回复
我加了现在到是能用了

但不能播放 这是为什么? 运行没有任何的反映 用mediaplay 可以放
beyondtkl 2004-11-04
  • 打赏
  • 举报
回复
uses MMSystem;
相关推荐
发帖
Windows SDK/API

1177

社区成员

Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
帖子事件
创建了帖子
2004-11-04 04:46
社区公告
暂无公告