MessageBeep - Play a System sound
There is a interesting function which can play a System sound.
First let's see the WinAPI.
//声明:
MessageBeep(
uType: UINT {参数是个常数; 根据不同的常数发出不同的声音, 也就是调用了不同的 wav}
): BOOL; //参数 uType 可选值:
MB_OK = ;
MB_ICONHAND = ;
MB_ICONQUESTION = ;
MB_ICONEXCLAMATION = ;
MB_ICONASTERISK = ; //举例, 下面代码会发出错误警告
begin
MessageBeep();
end; //另外 Delphi 的 Beep 方法在 SysUtils 单元是这样实现的:
procedure Beep;
begin
MessageBeep();
end;
If you wana beep in your console program. You can use it like following.
#include <Windows.h> int _tmain(int argc, _TCHAR* argv[])
{
for( UINT i = ; i < ; i ++) {
MessageBeep(i);
Sleep();
}
return ;
}
Well, Running it, it will beep differently in every second. Thank you!
MessageBeep - Play a System sound的更多相关文章
- iOS系统声音服务(System Sound Services)
系统声音服务(System Sound Services)提供了一个接口,用于播放不超过30秒的声音.它支持的文件格式有限,具体地说只有CAF.AIF和使用PCM或IMA/ADPCM数据的WAV文件. ...
- 使用System Sound Services 播放音效(最简单,比较底层),调用AudioServicesPlaySystemSound()
1.适用范围:一些很小的提示或警告音频. 2.使用限制: 声音长度不能超过30秒 声音文件必须是PCM或IMA4(IMA/ADPCM)格式.(有时候可播放一些特殊的.mp3) 打包成.caf..aif ...
- System Sounds: Alerts and Sound Effects
#include <AudioToolbox/AudioToolbox.h> #include <CoreFoundation/CoreFoundation.h> // Def ...
- 第十六章:自定义push notification sound
前面一节已经讲过如何在ionic中集成jpush,这样我们的hybrid app在部署到ios或者android上面的时候,就可以接收通知了.如果不满足系统自带的声音,可以通过一些方式来播放自定义的通 ...
- DLLImport
namespace Wintellect.Interop.Sound { using System; using System.Runtime.InteropServices; using Syste ...
- Windows API 常量定义
Windows 常量定义在winuser.h中可以找到,如果了安装了visual studio 2010,winuser.h所在目录为C:\Program Files (x86)\Microsoft ...
- Error Handling Functions(微软对于出错的情况下提供的所有函数,比如SetThreadErrorMode,SetErrorMode,SetLastErrorEx,FatalAppExit,CaptureStackbackTrace)
The following functions are used with error handling. Function Description Beep Generates simple ton ...
- iOS开发系列--音频播放、录音、视频播放、拍照、视频录制
--iOS多媒体 概览 随着移动互联网的发展,如今的手机早已不是打电话.发短信那么简单了,播放音乐.视频.录音.拍照等都是很常用的功能.在iOS中对于多媒体的支持是非常强大的,无论是音视频播放.录制, ...
- iOS - 系统提醒短音频
Demo下载地址 iPhone端系统Audio资源路径:/System/Library/Audio/UISounds 首先,通过 NSFileManager 获取资源路径下的所有路径(文件夹/文件) ...
随机推荐
- Linux下安装Anaconda
Anaconda官方下载地址: https://www.anaconda.com/download/ >>bash xxxxxx.sh >>reboot >>sud ...
- yii2 basic版本的一些配置
1.nginx配置 重写规则 修改访问模式为 http://wh.store/admin/index 文件位置: /home/wwwroot/default/yii2-app-basic/config ...
- iOS的SVN
1.cornerstone 2.smart svn mac (比较好用) 3.还xcode自带的.
- python命名规则
1 包.模块的命名规则:全部以小写字母形式来命名.比如:import random 2 类.对象的命名规则:类是每个单词的首字母要大写,其他字母小写比如:class MyFamily: ,类的私有属性 ...
- POJ-2533.Longest Ordered Subsequence (LIS模版题)
本题大意:和LIS一样 本题思路:用dp[ i ]保存前 i 个数中的最长递增序列的长度,则可以得出状态转移方程dp[ i ] = max(dp[ j ] + 1)(j < i) 参考代码: # ...
- short s1 = 1; s1 = s1 + 1;和 short s1 = 1; s1 += 1;的问题,终于弄懂了
对于short s1 = 1; s1 = s1 + 1; 由于s1+1运算时会自动提升表达式的类型,所以结果是int型,再赋值给short类型s1时,编译器将报告需要强制转换类型的错误. 对于shor ...
- 36. Valid Sudoku 判断九九有效的数独
[抄题]: Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according ...
- 将Promise融会贯通之路
前端初学者经常会问,我如何在ajax1结束之后才启动ajax2呢?我怎么做才能在所有的ajax结束之后触发某程序呢?亦或是哎真是烦,5个ajax套在一起,原来的逻辑是什么呀! 一个稍微有点经验的前端程 ...
- Python项目--Scrapy框架(二)
本文主要是利用scrapy框架爬取果壳问答中热门问答, 精彩问答的相关信息 环境 win8, python3.7, pycharm 正文 1. 创建scrapy项目文件 在cmd命令行中任意目录下执行 ...
- thinkphp 视图(一)
视图 View <?php namespace app\index\controller; class Index{ public function index(){ return view() ...