七七563 2024-07-29 16:52 采纳率: 0%
浏览 10
已结题

怎么在C++的MFC菜单项,获取USB摄像头的分辨率(操作系统-windows)

怎么在C++的MFC菜单项,获取USB摄像头的分辨率
例如:在Dialog中使用CComBox类成员GetWindowTextW

void CUVCDemoDlg::OnCbnSelchangeComboFormat()
{
    CString strFR;    
    m_cbo_format.GetWindowTextW(strFR);
    if (strFR == L"")
        return;
    CString strFmt = strFR.Left(4);
    if (strFmt == L"MJPG")
        m_videoFormat = VIDEOFORMAT_MJPG;
    else
        m_videoFormat = VIDEOFORMAT_YUY2;
    CString strRes = strFR.Mid(4);
    swscanf(strRes, L"%dx%d", &m_videoW, &m_videoH);
    if (m_bConnectedPrevious) {
        OnBnClickedButtonPreview();
    }
}

效果图如下

img

问一下在菜单项中,怎么去获取,感谢

img

img

void CMainFrame::OnMenuFormat()
{
    CString strFR;
    /*m_menu_format.GetWindowTextW(strFR);*/  //类CMenu中没有成员GetWindowTextW
    if (strFR == L"")
        return;
    CString strFmt = strFR.Left(4);
    if (strFmt == L"MJPG")
        m_videoFormat = VIDEOFORMAT_MJPG;
    else
        m_videoFormat = VIDEOFORMAT_YUY2;
    CString strRes = strFR.Mid(4);
    swscanf(strRes, L"%dx%d", &m_videoW, &m_videoH);
    if (m_bCameraConnected) {
        PostMessage(WM_OPENDEV,0,0);
    }
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 8月6日
    • 创建了问题 7月29日