MediaFoundation使用摄像头显示视频,在上面叠加文字,但被摄像头的视频覆盖。例子的MediaFoundation的SimpleCapture。在WM_PAINT消息中的代码如下
void OnPaint( HWND hwnd )
{
PAINTSTRUCT ps;
HDC hdc = 0;
hdc = BeginPaint( hwnd , &ps );
if( hdc )
{
if( g_pPreview && g_pPreview->HasVideo( )) g_pPreview->UpdateVideo( );
else FillRect( hdc , &ps.rcPaint , ( HBRUSH )( COLOR_APPWORKSPACE + 2 ));
// 在此可以显示用户需要的信息
TCHAR str[] = L"显示摄像头内容";
TextOut( hdc , 10 , 10 , str , lstrlen( str ));
}
EndPaint( hwnd , &ps );
}
