用C++编写的控制体应用程序能播放音频吗?
答案:1 悬赏:60 手机版
解决时间 2021-04-23 19:00
- 提问者网友:献世佛
- 2021-04-22 19:45
如问,如果行能把它写出来吗?
最佳答案
- 五星知识达人网友:鸽屿
- 2021-04-22 20:46
#include <stdio.h>
#include <dshow.h>
#pragma comment( lib, "strmiids.lib" )
int main()
{
IGraphBuilder *pGB = NULL;
IMediaControl *pMC = NULL;
IVideoWindow *pVW = NULL;
CoInitialize( NULL );
CoCreateInstance( CLSID_FilterGraph,NULL,CLSCTX_INPROC,IID_IGraphBuilder, (void** )&pGB );
pGB->QueryInterface( IID_IMediaControl, (void** )&pMC );
pGB->QueryInterface( IID_IVideoWindow, (void** )&pVW );
pGB->RenderFile( L"C:\\xxx.mp3", NULL );
pVW->put_WindowStyle( WS_CHILD | WS_CLIPSIBLINGS );
pVW->SetWindowPosition( 0,0,400,300 );
pMC->Run();
getchar();
pVW->Release();
pMC->Release();
pGB->Release();
}
#include <dshow.h>
#pragma comment( lib, "strmiids.lib" )
int main()
{
IGraphBuilder *pGB = NULL;
IMediaControl *pMC = NULL;
IVideoWindow *pVW = NULL;
CoInitialize( NULL );
CoCreateInstance( CLSID_FilterGraph,NULL,CLSCTX_INPROC,IID_IGraphBuilder, (void** )&pGB );
pGB->QueryInterface( IID_IMediaControl, (void** )&pMC );
pGB->QueryInterface( IID_IVideoWindow, (void** )&pVW );
pGB->RenderFile( L"C:\\xxx.mp3", NULL );
pVW->put_WindowStyle( WS_CHILD | WS_CLIPSIBLINGS );
pVW->SetWindowPosition( 0,0,400,300 );
pMC->Run();
getchar();
pVW->Release();
pMC->Release();
pGB->Release();
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯