[vtkusers] capture mouse position

Andrew Wilford andrew at artwork.com
Wed Sep 14 08:31:12 EDT 2005


Hi,

To capture the mouse in MFC, use WindowProc. Here's how I do it...

LRESULT CView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{

// Get mouse point

  WORD lw = LOWORD(lParam);
  WORD hw = HIWORD(lParam);

// Check message

  switch(message) {

// Left button down

    case WM_LBUTTONDOWN: {

// Transform to VTK co-ordinate system

          INT x = 0;
          INT y = 0;
          m_Interactor->GetSize(x, y);
          x = lw;
          y = y - hw;

         break;
     }
  }
}

Andrew Wilford




More information about the vtkusers mailing list