CString filter; filter = "所有文件(*.avi,*.3gp,*.mp4,*.rm,*rmvb,*flash) | *.avi;*.3gp;*.mp4;*.rm;*.rmvb;*flash"; CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY, filter, NULL); if (dlg.DoModal() == IDOK) { CString FileName = dlg.GetPathName(); //获取文件路径名 如D:picabc.bmp using std::string; string filename = (CStringA)FileName; CImage myImage; cv::VideoCapture capture; cv::Mat myImagine; capture.open(filename); CRect rect; GetDlgItem(IDC_STATIC)->GetClientRect(&rect); while (true) { capture >> myImagine; cv::imshow("view", myImagine); cvWaitKey(40); }