readme.wzd

来自「MFC扩展编程实例」· WZD 代码 · 共 40 行

WZD
40
字号
/////////////////////////////////////////////////////////////////////
// To play a beep
/////////////////////////////////////////////////////////////////////

// 1) to play a simple tone
	::Beep(  1000,    // sound frequency, in hertz (the higher the number the higher the pitch)
	 1000);   // sound duration, in milliseconds);

/////////////////////////////////////////////////////////////////////
// To play a separate .WAV file
/////////////////////////////////////////////////////////////////////

// 1) include <mmsystem.h> and link your project with winmm.lib

// 2) to play a .WAV file
	::sndPlaySound("sound.wav",SND_SYNC);	// and SND_ASYNC for async sound
											// and SND_ASYNC|SND_LOOP for continual play

/////////////////////////////////////////////////////////////////////
// To play a .WAV file from your application's resources
/////////////////////////////////////////////////////////////////////

// 1) include <mmsystem.h> and link your project with winmm.lib

// 2) add a .WAV file to your project (see the book for an easy way.)

// 3) to play the .WAV file resource
	HRSRC hRsrc = FindResource(AfxGetResourceHandle(),MAKEINTRESOURCE(IDR_SOUND),"WAV");
	HGLOBAL hglb = LoadResource(AfxGetResourceHandle(), hRsrc);
	::sndPlaySound((LPCTSTR)::LockResource(hglb),SND_MEMORY|SND_SYNC|SND_NODEFAULT);
	FreeResource(hglb);



/////////////////////////////////////////////////////////////////////
// From: Visual C++ MFC Programming by Example by John E. Swanke
// Copyright (C) 1999 jeswanke. All rights reserved.
/////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?