示例#1
0
void ImgEditWindow::setupCallbacks() {

    cvSetMouseCallback(cvGetWindowName(m_window),
            &ImgEditWindow::wrapperToOnMouseCallback,
            this);

}
示例#2
0
HRESULT cvcamSourceFile::Start()
{
    try
    {
    
    if (IsRunning())
    {
        return NOERROR;
    }

    //Set up the window
    
    m_hr = m_pVideoWindow->put_Owner((OAHWND)m_hWnd);
    long flags;
    m_hr = m_pEvent->SetNotifyWindow((OAHWND)m_hWnd, WM_GRAPHNOTIFY, 0);
    m_hr = m_pEvent->SetNotifyFlags(0x00);
    m_hr = m_pEvent->CancelDefaultHandling(EC_COMPLETE);
    m_hr = m_pVideoWindow->get_WindowStyle(&flags);
    m_hr = m_pVideoWindow->put_WindowStyle(flags & (~WS_CAPTION) | WS_CHILD);
    m_hr = m_pVideoWindow->put_MessageDrain((OAHWND)m_hWnd);

    // Get the rectangle dimensions and resize the client window
    m_hr = m_pGraph->QueryInterface(IID_IBasicVideo,(void**)&m_pBasicVideo);
     
    long left, top, w, h;
    m_pBasicVideo->GetSourcePosition(&left, &top,&w,&h);
    m_pBasicVideo->SetDestinationPosition(0, 0, m_width?m_width:w, m_height?m_height:h);
    m_pVideoWindow->SetWindowPosition(0,0,m_width?m_width:w,m_height?m_height:h);
    const char* name = cvGetWindowName(m_hWnd);
    cvResizeWindow(name, m_width?m_width:w, m_height?m_height:h);
        
        
    
    // Run the graph.
    m_hr = m_pMediaControl->Run();
    
    return S_OK;
    
    }//try
    catch(HrExeption exp)
    {
        return exp.hr;
    }//catch

}