修改VC++6.0生成的EXE图标 和添加.wav 音乐

修改VC++6.0生成的EXE图标

一、自己找一个.ico的文件,COPYres文件夹里,然后把它名字改成原来MFC自带图标的名字(在这之前你需要把自带图标删掉或者改成其他名字),

二、在VC左面的资源视图里,有个ICON项,删除原来的IDR_MAINFRAME文件,引入自己的.ico文件。

ID改为ID_MAINFRAME.

 

添加.wav音乐

1.在Resource引入.wav 文件,定义ID为ID_MUSIC4.

2.在子菜单 “音乐” 添加菜单项  ID_OPEN_MUSIC4  “很爱很爱你”

添加菜单响应函数

void CResumeView::OnOpenMusic4()
{
 // TODO: Add your command handler code here
 sndPlaySound(MAKEINTRESOURCE(IDR_MUSIC4),SND_RESOURCE | SND_ASYNC | SND_LOOP);
}

注意在View类头文件

#include  "mmsystem.h"

project----Setting的LINK标签页 下  object/modual libary下加入:

winmm.lib

 

相应的API

sndPlaySound

The sndPlaySound function plays a waveform sound specified either by a filename or by an entry in the registry or the WIN.INI file. This function offers a subset of the functionality of the PlaySound function; sndPlaySound is being maintained for backward compatibility.

BOOL sndPlaySound( LPCSTR lpszSound, 
 UINT fuSound 
);
 

Parameters

lpszSound
A string that specifies the sound to play. This parameter can be either an entry in the registry or in WIN.INI that identifies a system sound, or it can be the name of a waveform-audio file. (If the function does not find the entry, the parameter is treated as a filename.) If this parameter is NULL, any currently playing sound is stopped.
fuSound
Flags for playing the sound. The following values are defined:
SND_ASYNC
The sound is played asynchronously and the function returns immediately after beginning the sound. To terminate an asynchronously played sound, call sndPlaySound with lpszSoundName set to NULL.
SND_LOOP
The sound plays repeatedly until sndPlaySound is called again with the lpszSoundName parameter set to NULL. You must also specify the SND_ASYNC flag to loop sounds.
SND_MEMORY
The parameter specified by lpszSoundName points to an image of a waveform sound in memory.
SND_NODEFAULT
If the sound cannot be found, the function returns silently without playing the default sound.
SND_NOSTOP
If a sound is currently playing, the function immediately returns FALSE, without playing the requested sound.
SND_SYNC
The sound is played synchronously and the function does not return until the sound ends.

Return Values

Returns TRUE if successful or FALSE otherwise.

Remarks

If the specified sound cannot be found, sndPlaySound plays the system default sound. If there is no system default entry in the registry or WIN.INI file, or if the default sound cannot be found, the function makes no sound and returns FALSE.

The specified sound must fit in available physical memory and be playable by an installed waveform-audio device driver. If sndPlaySound does not find the sound in the current directory, the function searches for it using the standard directory-search order.

QuickInfo

  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Requires version 2.0 or later.
  Header: Declared in mmsystem.h.
  Import Library: Use winmm.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.


 

 

你可能感兴趣的:(windows,function,System,exe,音乐,vc++)