none
How to fill the area with video preview RRS feed

  • Question

  • Hi,

    I am creating a video capture application.

    there is menu and status window on the screen (at the top and bottom), so the rest of the screen width:height ratio isn't 4:3 and when the video loads there are empty areas on the sides of the screen.

    Does anyone know how to load elements (windows) in order to fill the given area with video and not distorting the image ratio (overwrite the top and the bottom of the image with status window and menu)?

    Here is the function which loads screen elements:

    int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
        ToggleFullScreen(TRUE); 
        CScreenOrientation::SetScreenOrientation(270); 
        if (CFrameWnd::OnCreate(lpCreateStruct) == -1) 
            return -1; 
     
        RECT r; 
        GetWindowRect(&r); 
        if (!m_wndStatus.Create(NULL, NULL, WS_CHILD | WS_VISIBLE,  
                    CRect(0, 0, r.right, TOOLBAR_HEIGHT), this, AFX_IDW_PANE_FIRST + 1, NULL)) 
        { 
            TRACE0("Failed to create status view\n"); 
            return -1; 
        } 
     
        // Create a camera view 
        if (!m_wndCameraView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, 
            CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL)) 
        { 
            TRACE0("Failed to create camera view\n"); 
            return -1; 
        } 
        m_wndCameraView.SetLogDirectory(m_Settings.m_LogDirectory); 
     
        if (!m_wndCommandBar.Create(this) || 
            !m_wndCommandBar.AddAdornments(dwAdornmentFlags) || 
            !m_wndCommandBar.InsertMenuBar(IDR_MAINFRAME)) 
        { 
            TRACE0("Failed to create CommandBar\n"); 
            return -1;      // fail to create 
        } 
     
        m_wndCommandBar.SetBarStyle(m_wndCommandBar.GetBarStyle() | CBRS_SIZE_FIXED); 
     
        m_QueueProgressData.SetHandle(this); 
     
        // Update GUI state 
        UpdateGUIState(); 
     
        //VideoPreviewShow(); 
         
        // TODO: check error 
        m_SleepModeTimerID = SetTimer(1, (UINT)1000, (TIMERPROC)CMainFrame::SleepModeTimer); 
     
        PostMessage(WM_CHECK_UPGRADE, 0, 0); 
     
        return 0; 

    Thanks for help!

    Niko



    Niko
    Thursday, December 18, 2008 2:38 PM