[問題] MFC對話框

看板C_and_CPP (C/C++)作者 (冬瓜)時間16年前 (2009/11/03 16:01), 編輯推噓2(202)
留言4則, 4人參與, 最新討論串1/1
將一個視訊畫面 移到MFC對話框中 之後 我的對話框的介面就無法移動 不知道是哪裡出了問題 這是我的CODE void CTest1Dlg::OnStart() { // TODO: Add your control notification handler code here CvCapture* capture = NULL; capture = cvCreateCameraCapture(0);//webcam IplImage* frame = NULL; //cvCreateImage(); for(;;) { frame = cvQueryFrame(capture); if(!frame) break; DrawPicToHDC(frame, IDC_STATIC_PIC); int c = cvWaitKey(10); if(c == 27) break; } cvReleaseCapture(&capture); } void CTest1Dlg::DrawPicToHDC(IplImage *img, UINT ID) { CDC *pDC = GetDlgItem(ID)->GetDC(); HDC hDC= pDC->GetSafeHdc(); CRect rect; GetDlgItem(ID)->GetClientRect(&rect); CvvImage cimg; cimg.CopyOf(img); cimg.DrawToHDC(hDC,&rect); ReleaseDC(pDC); } 完整的程式: http://www.badongo.com/cn/file/18192829# -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.127.182.4

11/03 22:06, , 1F
咬死了...要不要另外生個 thread 來取影像呢??
11/03 22:06, 1F

11/03 23:19, , 2F
不要把Windows Message Loop給吃光... 那種做法很不智
11/03 23:19, 2F

11/04 00:21, , 3F
哇。for(;;)耶.. 建議生個thread來處理,否則UI會卡死..
11/04 00:21, 3F

11/04 15:01, , 4F
這大概是實驗性質的程式寫法...看到for(;;)我笑了 :)
11/04 15:01, 4F
文章代碼(AID): #1Ax-DVOZ (C_and_CPP)
文章代碼(AID): #1Ax-DVOZ (C_and_CPP)