Jump to content
  • Advertisement
Sign in to follow this  
ak09

[Win32] "Custom" resize box

This topic is 2037 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement

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?

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!