⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 speakerphone.cpp

📁 switch speaker on windows mobile platform
💻 CPP
字号:
// speakerphone.cpp : Defines the entry point for the application.
//

#include "stdafx.h"
#include <windows.h>
#include <commctrl.h>

#define IOCTL_WAV_MESSAGE 0x1D000C

typedef struct 
{
	UINT uDeviceId;			
	UINT uMsg;				
	DWORD dwUser;			
	DWORD dwParam1;			// Specifies the first message parameter. Dependent on message type. 
	DWORD dwParam2;			// Specifies the second message parameter. Dependent on message type. 
} MMDRV_MESSAGE_PARAMS;

bool SpeakerPhone2003()
{
	HANDLE g_hWavDev = CreateFile(TEXT("WAV1:"),
        GENERIC_READ | GENERIC_WRITE,
        0,
        NULL,
        OPEN_EXISTING,
        0,
        NULL);

	DWORD dwRet;
	if (g_hWavDev)
	{		
		DWORD out;
		MMDRV_MESSAGE_PARAMS mp;
		memset(&mp,0,sizeof(mp));
		mp.uMsg = 102;
		bool res = (DeviceIoControl(g_hWavDev, IOCTL_WAV_MESSAGE, 
			&mp,sizeof(mp),&out,sizeof(out), &dwRet,0) == 1);
		CloseHandle(g_hWavDev);

		return res;
	}
	else return 0;
}

int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPTSTR    lpCmdLine,
                   int       nCmdShow)
{
	_debug(L"app entry point");
	_debug(L"Speakerphone result:%d",SpeakerPhone2003());
	return 0;
}

⌨️ 快捷键说明

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