| 发表于:2008-01-14 22:29:131楼 得分:0 |
这个程序没有出现问题: uint threadfun(lpvoid wparam) { ccapturedlg *pdlg=(ccapturedlg*)wparam; pdlg-> m_hvideownd=capcreatecapturewindow("capture",ws_popup,5,5,20,20,*pdlg,0); if(pdlg-> m_hvideownd){ pdlg-> m_event.setevent(); msg msg; while(getmessage(&msg,pdlg-> m_hvideownd,0,0)){ translatemessage(&msg); dispatchmessage(&msg); } return msg.wparam; } return 0; } bool ccapturedlg::oninitdialog() { cdialog::oninitdialog(); m_pthread=afxbeginthread(threadfun,(lpvoid)this); m_event.resetevent(); ::waitforsingleobject(m_event,infinite); crect rect; getclientrect(&rect); rect.deflaterect(1,1,1,1); if(m_hvideownd){ if(capdriverconnect(m_hvideownd,0)==false){ messagebox("出错!"); return 0; } ::setparent(m_hvideownd,*this); ::setwindowlong(m_hvideownd,gwl_style,ws_child); ::setwindowpos(m_hvideownd,null,rect.left,rect.top,rect.width(),rect.height(),swp_noredraw); ::showwindow(m_hvideownd,sw_show); cappreviewrate(m_hvideownd,10); cappreview(m_hvideownd,true); capoverlay(m_hvideownd,true); } // set the icon for this dialog. the framework does this automatically // when the application's main window is not a dialog seticon(m_hicon, true); // set big icon seticon(m_hicon, false); // set small icon // todo: add extra initialization here return true; } | | |
|