Jump to content
  • Advertisement
Sign in to follow this  
SteveDeFacto

C++ function to check if a window is sizing/moving?

This topic is 2551 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

Finally done with school and working on my engine once again. Right now I'm looking for some way to check if a window is sizing/moving without using WinProc and WM_ENTERSIZEMOVE/WM_EXITSIZEMOVE. I've looked over the documentation but I don't see any functions to do that. Does anyone know what I can do?

Share this post


Link to post
Share on other sites
Advertisement
Any window resizing or movement will necessarily be handled in the event loop. You could wrap your window in a class and expose the handling for the events via virtual functions, signals/slots, callbacks, etc.

Or perhaps you're looking for information on hooks?

Share this post


Link to post
Share on other sites
If you care about this information, why not just set a bool to true when WM_ENTERSIZEMOVE is called and to false when WM_EXITSIZEMOVE is called?

Share this post


Link to post
Share on other sites

If you care about this information, why not just set a bool to true when WM_ENTERSIZEMOVE is called and to false when WM_EXITSIZEMOVE is called?


All global variables for my engine are contained in the instance class. My window wrapper class is then created from the instance class. The instance class contains a list of all windows and in turn each window has a pointer to the instance which created it. So from a callback such as WinProc there is no way to know which instance or window wrapper the window belongs to. This prevents me from doing what you suggested.

Share this post


Link to post
Share on other sites
Then use SetWindowLongPtr() to store a pointer to the window class with GWLP_USERDATA and retrieve it with GetWindowLongPtr() in the wndproc.

Share this post


Link to post
Share on other sites

Then use SetWindowLongPtr() to store a pointer to the window class with GWLP_USERDATA and retrieve it with GetWindowLongPtr() in the wndproc.


I forgot about that! Thank you!

Share this post


Link to post
Share on other sites
Hidden

Then use SetWindowLongPtr() to store a pointer to the window class with GWLP_USERDATA and retrieve it with GetWindowLongPtr() in the wndproc.


Actually still having a problem. Here is what I'm doing but I get an access violation when I try to use the pointer:


Set pointer
SetWindowLongPtr( Window->hWnd, GWLP_USERDATA, (LONG)Window );

Get pointer
Ovgl::Window* Window = (Ovgl::Window*)GetWindowLongPtr( hWnd, GWLP_USERDATA );

Share this post


Link to post
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!