WM_NCHITTEST and borders
-
Heya everybody. I got a question about WM_NCHITTEST... I got a window with thick border and to prevent the user to resize it, I have to interpret WM_NCHITTEST and return HTBORDER when the mouse is over the border. However... the question is... is there an easy way to know when the mouse is over the border??? Or do I have to make some arithmetical checks for this? As far as I see the problem right now, the only way to determine when the mouse is over a border is to calculate by using the lParam of WM_NCHITTEST which tells me screen-relative X/Y position. -= E C H Y S T T A S =- The Greater Mind Balance
-
Heya everybody. I got a question about WM_NCHITTEST... I got a window with thick border and to prevent the user to resize it, I have to interpret WM_NCHITTEST and return HTBORDER when the mouse is over the border. However... the question is... is there an easy way to know when the mouse is over the border??? Or do I have to make some arithmetical checks for this? As far as I see the problem right now, the only way to determine when the mouse is over a border is to calculate by using the lParam of WM_NCHITTEST which tells me screen-relative X/Y position. -= E C H Y S T T A S =- The Greater Mind Balance
I did a test for you, add the 3 lines: //=============================== CMenu*pMu=GetSystemMenu(0); pMu->RemoveMenu(SC_SIZE,MF_BYCOMMAND); ModifyStyle(WS_MAXIMIZEBOX,0); //=============================== the window will not be sized.
A nice tool for optimizing your Microsoft html-help contents. Includeh10
-
Heya everybody. I got a question about WM_NCHITTEST... I got a window with thick border and to prevent the user to resize it, I have to interpret WM_NCHITTEST and return HTBORDER when the mouse is over the border. However... the question is... is there an easy way to know when the mouse is over the border??? Or do I have to make some arithmetical checks for this? As far as I see the problem right now, the only way to determine when the mouse is over a border is to calculate by using the lParam of WM_NCHITTEST which tells me screen-relative X/Y position. -= E C H Y S T T A S =- The Greater Mind Balance
Use the return value of the base class OnNcHitTest. MFC
UINT CMyWnd::OnNcHitTest(CPoint point)
{
UINT border = CWnd::OnNcHitTest(point);
switch (border)
{
case HT_BOTTOM:
border = HTBORDER;
break;
...
}return border;
}Win32
LRESULT CALLBACK WndProc (...)
{
switch (nMsg)
{
case WM_NCHITEST:
{
UINT border = ::DefWindowProc(hWnd, nMsg, wp, lp);
switch (border)
...Well, you get the idea
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!
-
Heya everybody. I got a question about WM_NCHITTEST... I got a window with thick border and to prevent the user to resize it, I have to interpret WM_NCHITTEST and return HTBORDER when the mouse is over the border. However... the question is... is there an easy way to know when the mouse is over the border??? Or do I have to make some arithmetical checks for this? As far as I see the problem right now, the only way to determine when the mouse is over a border is to calculate by using the lParam of WM_NCHITTEST which tells me screen-relative X/Y position. -= E C H Y S T T A S =- The Greater Mind Balance
WM_NCMOUSEMOVE
Nibu thomas Software Developer
-
I did a test for you, add the 3 lines: //=============================== CMenu*pMu=GetSystemMenu(0); pMu->RemoveMenu(SC_SIZE,MF_BYCOMMAND); ModifyStyle(WS_MAXIMIZEBOX,0); //=============================== the window will not be sized.
A nice tool for optimizing your Microsoft html-help contents. Includeh10
Thank you. I don't know if this would work on WIN32 though, since I am not using MFC. -= E C H Y S T T A S =- The Greater Mind Balance
-
Use the return value of the base class OnNcHitTest. MFC
UINT CMyWnd::OnNcHitTest(CPoint point)
{
UINT border = CWnd::OnNcHitTest(point);
switch (border)
{
case HT_BOTTOM:
border = HTBORDER;
break;
...
}return border;
}Win32
LRESULT CALLBACK WndProc (...)
{
switch (nMsg)
{
case WM_NCHITEST:
{
UINT border = ::DefWindowProc(hWnd, nMsg, wp, lp);
switch (border)
...Well, you get the idea
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!
Yeap, I got it. I should have thought at the DefWindowProc stuff. Hrmph *pissed off on self*. Thank you. -= E C H Y S T T A S =- The Greater Mind Balance