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 获取资源路径下的所有路径(文件夹/文件) ...
随机推荐
- easyui改变tab标题
截图: 代码: //更改tab的标题 var tab = $('#microAppVersionTabs').tabs('getTab',0);// 取得第一个tab $('#microAppVe ...
- 模型介绍之FastText
模型介绍一: 1. FastText原理及实践 前言----来源&特点 fastText是Facebook于2016年开源的一个词向量计算和文本分类工具,在学术上并没有太大创新.但是它的优点也 ...
- AS3中的getChildByName
[转载的...............] 在AS3中,我们可以用getChildByName来获取一个元件,但是要注意返回的类型是DisplayObject,这样一旦我们的元件中有一些自定义的方法就不 ...
- Cocos2dx Android工程的启动过程
1.安卓工程下的设置启动activity为src下面的AppActivity,启动调用的onCreate并没有做过多的事情,只是调用了父类Cocos2dxActivity的onCreate.AppAc ...
- mysql学习笔记--列属性
一.是否为空----null || not null 二.默认值----default 三.自动增长----auto_increment 四.主键----primary key 1. 主键:唯一标识表 ...
- 796. Rotate String旋转字符串
[抄题]: We are given two strings, A and B. A shift on A consists of taking string A and moving the lef ...
- 259. 3Sum Smaller小于版3sum
[抄题]: Given an array of n integers nums and a target, find the number of index triplets i, j, k with ...
- Shell中read命令--学习
read命令 -p(提示语句) -n(字符个数) -t(等待时间) -s(不回显) 1.基本读取read命令接收标准输入(键盘)的输入,或其他文件描述符的输入(后面在说).得到输入后,read命令将数 ...
- [leetcode]20. Valid Parentheses有效括号序列
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the inpu ...
- sql注入case
or 1=1or 1=1--or 1=1#or 1=1/*admin' --admin' #admin'/*admin' or '1'='1admin' or '1'='1'--admin' or ' ...