Ok, so I have a rectangle drawn on my screen (via OpenGL), and I want to make it resizable — just like the standard resize box of all windows.
Is there a simple way, other than checking mannualy if mouse position is here or there and changing cursor again and again , to do it?
🔒 Locked
[Win32] "Custom" resize box
Advertisement
Original Post
Handle the WM_NCHITTEST message and return HTSIZE when the cursor overlaps the rectangle.
Handle the WM_NCHITTEST message and return HTSIZE when the cursor overlaps the rectangle.
The rectangle I mentioned represents a layer on wich my stuff will be drawn.
But I'm dealing with several layers. So, doesn't your suggestion implies in making HWND's of my layers?
All you should have to do is handle that message in the parent window and convert the coordinates provided so they can be tested against your rectangle. It doesn't need to have its own HWND and indeed giving it it's own HWND wouldn't enable it to get WM_NCHITTEST (that's only for the parent/container window itself, not child windows).
I got it, but returning HTSIZE when mouse is over my area just makes it freeze.
This is what I get:
case WM_NCHITTEST:
if (onArea(LOWORD(lParam), HIWORD(lParam))
return HTSIZE;
return DefWindowProc(hWnd, msg, wParam, lParam);
Solved!
Instead of HTSIZE I return now HTBOTTOMRIGHT.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement