I made a dialog-based MFC application, put a picture frame there and
used it to display my OpenGL objects. I would like to control the
rotation etc. of the object using mouse control. I have been able to
do this using OnLButtonUp/Down and OnMouseMove from the parent dialog
window. My question is: How do I set it so that the mouse controls the
movement of the object only if it is within the OpenGL frame? Right
now, I can still control the rotation even if the mouse if outside the
frame.

Thanks.

David

----------------------------------------------------------

BOOL CAccuRadDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);

CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}

// 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

// Initialize control parameters
SetDefaultParameters();

// OpenGL window in a Picture object in Dialog
CStatic *pclStatic = (CStatic *) GetDlgItem(IDC_OPENGLWIN);
m_pclGlView = new CGlView(pclStatic, this);

// Device context for painting
CPaintDC dc(this);
HDC m_hDC;
m_hDC = ::GetDC(this->m_hWnd);

RECT rect;
GetClientRect(&rect);

int iWidth = -(rect.right - rect.left);
int iHeight = (rect.top - rect.bottom);

// Draw initial picture in the GL box
m_pclGlView->OnCreate();
m_pclGlView->ResizeGlScene(iWidth, iHeight);
m_pclGlView->InitGl();
m_pclGlView->DrawGlScene();

return TRUE; // return TRUE unless you set the focus to a control
}