用MCI处置WAV视频时,怎样才能让视频在当前窗口播放
用MCI处理WAV视频时,怎样才能让视频在当前窗口播放
MCI播放视频默认是新开一个窗口播放,播放完毕返回原来的窗口,想着原来窗口播放如何做?
mciSendCommand或mciSendString怎样在播放avi时不弹出另一个窗口播放,我需要在之前设计好的窗口里播放。
我的代码:
//mciSendCommand
void mic_avi_play(char say_or_wmv[])
{
MCIDEVICEID dev[20];
MCI_OPEN_PARMS mciOpen;
MCI_PLAY_PARMS mciPlay;
mciOpen.lpstrElementName="sola.wmv";
if(mciSendCommand(NULL,MCI_OPEN, MCI_OPEN_ELEMENT ,
(DWORD)&mciOpen)==0)
dev[0]=mciOpen.wDeviceID;
else
mciOpen.wDeviceID=dev[0];
mciPlay.dwFrom = 0;
mciSendCommand(mciOpen.wDeviceID,MCI_PLAY,MCI_NOTIFY | MCI_FROM,(DWORD)&mciPlay);
}
//mciSendString
void OnMyMenu(HWND hWnd)
{
mciSendString("open sola.wmv alias aa",NULL,0,hWnd);
mciSendString("play aa wait",NULL,0,hWnd);
mciSendString("close aa",NULL,0,hWnd);
}
//两个函数是一个效果
------解决方案--------------------
再OPEN之后,PLAY之前,发送MCI_WINDOW消息
可以参考下面的例子
MCI_DGV_WINDOW_PARMS WindowParms;
WindowParms.dwCallback = NULL;
WindowParms.hWnd = m_StaticAVI.GetSafeHwnd();
WindowParms.nCmdShow = SW_SHOW;
WindowParms.lpstrText = (LPSTR) NULL;
mciSendCommand( mciOpen.wDeviceID, MCI_WINDOW, MCI_DGV_WINDOW_HWND, (DWORD)&WindowParms );
MCI播放视频默认是新开一个窗口播放,播放完毕返回原来的窗口,想着原来窗口播放如何做?
mciSendCommand或mciSendString怎样在播放avi时不弹出另一个窗口播放,我需要在之前设计好的窗口里播放。
我的代码:
//mciSendCommand
void mic_avi_play(char say_or_wmv[])
{
MCIDEVICEID dev[20];
MCI_OPEN_PARMS mciOpen;
MCI_PLAY_PARMS mciPlay;
mciOpen.lpstrElementName="sola.wmv";
if(mciSendCommand(NULL,MCI_OPEN, MCI_OPEN_ELEMENT ,
(DWORD)&mciOpen)==0)
dev[0]=mciOpen.wDeviceID;
else
mciOpen.wDeviceID=dev[0];
mciPlay.dwFrom = 0;
mciSendCommand(mciOpen.wDeviceID,MCI_PLAY,MCI_NOTIFY | MCI_FROM,(DWORD)&mciPlay);
}
//mciSendString
void OnMyMenu(HWND hWnd)
{
mciSendString("open sola.wmv alias aa",NULL,0,hWnd);
mciSendString("play aa wait",NULL,0,hWnd);
mciSendString("close aa",NULL,0,hWnd);
}
//两个函数是一个效果
------解决方案--------------------
再OPEN之后,PLAY之前,发送MCI_WINDOW消息
可以参考下面的例子
MCI_DGV_WINDOW_PARMS WindowParms;
WindowParms.dwCallback = NULL;
WindowParms.hWnd = m_StaticAVI.GetSafeHwnd();
WindowParms.nCmdShow = SW_SHOW;
WindowParms.lpstrText = (LPSTR) NULL;
mciSendCommand( mciOpen.wDeviceID, MCI_WINDOW, MCI_DGV_WINDOW_HWND, (DWORD)&WindowParms );
jpg改rar![](https://images2015.cnblogs.com/blog/923483/201703/923483-20170327151320748-799436259.jpg)
![](https://images2015.cnblogs.com/blog/923483/201703/923483-20170327151320748-799436259.jpg)