[Win32] "Custom" resize box

Started by
4 comments, last by ak09 10 years, 11 months ago

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?

Advertisement
Handle the WM_NCHITTEST message and return HTSIZE when the cursor overlaps the rectangle.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

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).

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

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.

This topic is closed to new replies.

Advertisement