我利用网上的一段视频采集程序
http://www.codeguru.com/Cpp/misc/misc/video/article.php/c3771/其中调整视频格式是直接调用capDlgVideoFormat来调整的,但是现在发现在调整分辨率时,从低往高调整,界面根本没有变化,只有关闭程序重新启动才会变化,另外从高往低调整界面才会变化,但是仍旧会残留一些视频窗口的框框,也就是说改变了视频格式中的分辨率后,界面没有即时刷新。我现在想实现让它即时变化,不要重启之后才能看出效果。各位兄弟对视频采集比较熟悉的帮忙看看,现在急用,解决后重谢

解决方案 »

  1.   

    解决了,写了一个函数,供大家参考,同时谢谢DentistryDoctor(牙科医生)的热心参与!
    LayoutVideo()
    {
        RECT rc;
        RECT rcCap;
        CAPSTATUS cs;
        int cx, cy;
        POINT ptScroll; HWND hwnd = m_pWnd->GetSafeHwnd();    // get the x and y scroll pos so we can reset them
        ptScroll.y = ::GetScrollPos(hwnd, SB_VERT);
        ptScroll.x = ::GetScrollPos(hwnd, SB_HORZ);    ::GetClientRect(hwnd, &rc);
        if (!m_VFWImageProc.GetCapStatus(&cs)) 
    {
            // no current window? - make it 0 size
            cs.uiImageWidth = 0;
            cs.uiImageHeight = 0;    }    ::SetRect(&rcCap, 0, 0, cs.uiImageWidth, cs.uiImageHeight);    // centre the window if requested and if room    if(m_bCenterVideo) 
    {
        CRect Rect;
    m_pWnd->GetClientRect(Rect);
            cx = max(0, (Rect.Width() - (int) cs.uiImageWidth)/2);
            cy = max(0, (Rect.Height() - (int) cs.uiImageHeight)/2);
    Rect.OffsetRect(cx, cy);
    m_VFWImageProc.EnablePreviewVideo(m_pWnd->GetSafeHwnd(), Rect.TopLeft().x,Rect.TopLeft().y,Rect.Width(),Rect.Height());
    }
    else
    {
        CRect Rect;
    m_pWnd->GetClientRect(Rect);
    m_VFWImageProc.EnablePreviewVideo(m_pWnd->GetSafeHwnd(), Rect.TopLeft().x,Rect.TopLeft().y);
    }
    m_pWnd->Invalidate(TRUE);
    }