Resize Capture Window

I am trying to change the size of the graphics device buffer when the window is resized, but I was unlucky in detecting the event.

This is C ++ Windows programming. I tried:

while(WM_QUIT != msg.message){ if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)){ switch(msg.message){ case WM_SIZE: return; //<-- If the program closes because of this return, then I know I found the right statements. } //TranslateMessage(&msg); //DispatchMessage(&msg); }else{ poly.setConstantBuffer(space.getCamera()); poly.draw(iSize); graphics.render(); } } 

He does not return, therefore this is not true. What is the correct way to capture a resize event?

+4
source share
2 answers

You should process messages in your window procedure, and not in a message loop. PeekMessage does not return sent messages, and PeekMessage does not return a sent message.

+4
source

WM_SIZE is not the only message sent to the window during resizing. You need to disable the TranslateMessage() and DispatchMessage() calls so that these other messages are processed. And your mssage window submission procedure should pass the raw messages to DefWindowProc() for processing by default. Are you all doing this?

+3
source

Source: https://habr.com/ru/post/1438795/


All Articles