DSHOW 全屏


1.通过video windows 来实现。



void PlaybackWindow::SetFullScreen(int bFull)
{
if(m_pVideoWindow)
{
LONG lFullScreen;
HWND hDrain=0;


m_pVideoWindow->get_FullScreenMode(&lFullScreen);


if(bFull && lFullScreen==OAFALSE )
{
m_pVideoWindow->get_MessageDrain((OAHWND *) &hDrain);
m_pVideoWindow->get_Owner(&m_oahwnd);


m_pVideoWindow->put_MessageDrain((OAHWND) m_hWnd);


HRESULT hr = m_pVideoWindow->put_FullScreenMode(OATRUE);




}
else
{
if(lFullScreen == OATRUE)
{
m_pVideoWindow->put_FullScreenMode(OAFALSE);


m_pVideoWindow->put_MessageDrain((OAHWND) m_hWnd);




m_pVideoWindow->put_Owner(m_oahwnd);
m_pVideoWindow->SetWindowForeground(-1);


UpdateWindow();
SetForegroundWindow();
}
}


}
}


2.通过拉伸窗口来实现




void PlaybackWindow::OnFullscreen(int m_bFullScreen)  
{  


HRESULT hr=S_OK;
if(m_bFullScreen)
{
CRect rect;
GetWindowRect(&m_VideoWndRect); 


// Set message drain to application main window       
m_pVideoWindow->put_MessageDrain((OAHWND)m_hWnd);   


m_pVideoWindow->get_Owner(&m_oahwnd);
m_pVideoWindow->put_Owner((OAHWND)NULL);                
m_pVideoWindow->put_WindowStyle(0);       
m_pVideoWindow->put_WindowStyleEx(WS_EX_TOPMOST|WS_POPUP);       

m_pVideoWindow->SetWindowPosition(0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));

 
}   
else    
{       
m_pVideoWindow->put_MessageDrain((OAHWND)m_hWnd);        
m_pVideoWindow->put_Visible(OAFALSE);       
m_pVideoWindow->put_Owner((OAHWND)m_oahwnd);       
m_pVideoWindow->put_WindowStyle(WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN);        
m_pVideoWindow->SetWindowForeground(OATRUE);        
   
ScreenToClient(&m_VideoWndRect);
BuildPlayerLayout(&m_VideoWndRect);


//m_pVideoWindow->SetWindowPosition(m_VideoWndRect.left,m_VideoWndRect.top,m_VideoWndRect.right,m_VideoWndRect.bottom);
 m_pVideoWindow->put_Visible(OATRUE); 
  
}


}  





你可能感兴趣的:(dshow,视频解码)