📄 cmysoundincall .cs
字号:
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
namespace SmartAnswerCall
{
class CMysoundincall
{
typedef long (* _PES)(TCHAR *szEvent, DWORD dwParam);
typedef long (* _SES)(LPCTSTR strEventName);
public:
_PES pfnPES;
_SES pfnSES;
HINSTANCE m_hDll;
CMysoundincall();
MyPlaySound(TCHAR * szevent)
{
pfnPES(szevent,0);
}
MyStopSound(TCHAR * szevent)
{
pfnSES(szevent);
}
~CMysoundincall();
};
////////////类成员函数///
CMysoundincall::CMysoundincall()
{
m_hDll= LoadLibrary(L"\\windows\\ossvcs.dll");
if (m_hDll)
{ pfnPES = (_PES)GetProcAddress(m_hDll,L"PlayEventSound");
pfnSES = (_SES)GetProcAddress(m_hDll,L"StopEventSounds");
}
}
CMysoundincall::~CMysoundincall()
{
if(m_hDll) FreeLibrary(m_hDll);
}
////////////////////////具体实现/
CMysoundincall *mysound=new CMysoundincall();
mysound->MyPlaySound(L"SMS");
//////播放短信声音,如果需要播放自己的声音
/////在[HKEY_CURRENT_USER\Sounds]\ControlPanel\Sounds]
////[HKEY_CURRENT_USER\SoundCategories\ControlPanel\SoundCategories]
//仿照sms建立相应的键值即可。
//菜单精灵的发声是建立了三个键值,
#define STRING_REGDIR_SOUND1 L"\\ControlPanel\\Sounds\\QPcall1"
#define STRING_REGDIR_SOUND2 L"\\ControlPanel\\Sounds\\QPcall2"
#define STRING_REGDIR_SOUND_DIR L"\\ControlPanel\\SoundCategories\\QPcall"
mysound->MyPlaySound(L"QPcall1");//接通发声
mysound->MyPlaySound(L"QPcall2");//通话时间提醒
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -