sled
asked on
disable window movement
Hello I 'm using Visual C++ 1.52 and have a CFormView project. The way it works now is the user can drag the main window by it's title bar. I want to disable this feature for this window. For some odd reason I can't get the
following function to respond when I use the mouse left button over the title bar. If I could get the nHitTest to return HTCAPTION when over the title bar. I could trick it to think the mouse is over something else by returning HTNOWHERE. Unfortunately, when I left click onto the title bar it won't go into the function. I tried tracing it with no luck! What am I doing wrong??? Note: I had the MFC app wizard make the following function with it's correct declaration and messages (it looks right).... it
should of worked ... I thought. Steve sguit@aol.com
void CPmixView::OnNcLButtonDown (UINT nHitTest, CPoint point)
{
// TODO: Add your message handler code here and/or call default
TRACE("%s\n","test");
CFormView::OnNcLButtonDown (nHitTest, point);
}
following function to respond when I use the mouse left button over the title bar. If I could get the nHitTest to return HTCAPTION when over the title bar. I could trick it to think the mouse is over something else by returning HTNOWHERE. Unfortunately, when I left click onto the title bar it won't go into the function. I tried tracing it with no luck! What am I doing wrong??? Note: I had the MFC app wizard make the following function with it's correct declaration and messages (it looks right).... it
should of worked ... I thought. Steve sguit@aol.com
void CPmixView::OnNcLButtonDown
{
// TODO: Add your message handler code here and/or call default
TRACE("%s\n","test");
CFormView::OnNcLButtonDown
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
RONSLOW's thanks..... I must not of been awake to realize I made the call from the wrong class! Here is the needed code (one way) for a user to disable window movement. it fools the mainframe into thinking that you clicked on the client area not the caption bar!
UINT CMainFrame::OnNcHitTest(CP oint point)
{
UINT nHitTest = CFrameWnd::OnNcHitTest(poi nt);
return (nHitTest == HTCAPTION) ? HTCLIENT : nHitTest;
}
UINT CMainFrame::OnNcHitTest(CP
{
UINT nHitTest = CFrameWnd::OnNcHitTest(poi
return (nHitTest == HTCAPTION) ? HTCLIENT : nHitTest;
}
ASKER