When user resizes main window of such app he needs to see in real time how it is going to end up looking. Good examples are OpenGL window and certain custom controls that don't handle WM_PRINTWINDOW message properly.Īnother point is that certain MDI applications have docked windows or area that need to be dynamically resized depending on the size of the whole app window. It might work for certain child window types, but can fail miserably for others. Taking a screenshot of the whole app is not so trivial as calling PrintWindow on the root window. Also a working demo would be nice too - preferably with compiled executable - programmers are all lazy bunch of people. The reason you are getting such a low rating (so far 3 votes and all '1') is probably because you didn't elaborate on your implementation of the solution. Include the following variable in CMainFrame: use PrintWindow to capture the window to our dc Ret = CallWindowProc((WNDPROC)m_hPrevProc, hwnd, uMsg, wParam, lParam) ĭcWnd.BitBlt( 0, 0, rcWnd.Width(), rcWnd.Height(), now wm_size is sent to all children, a lengthy operation have something to show during the following lengthy operationĭcWnd.StretchBlt( 0, 0, rcWnd.Width(), rcWnd.Height(), first of all stretch the previous captured image to If(m_rcCapture = CRect( 0, 0, 0, 0)) // capture for the first time LRESULT CMainFrameResize::OnWindowPosChanged(HWND hwnd, UINT uMsg, This way, there is an illusion of immediate resizing, and to the eye, it appears with almost no flickering. Right after WM_WINDOWPOSCHANGED is received, it stretches the old window contents over the new window (using StretchBlt, because the new window size may be larger or smaller than the captured window). The class CMainFrameResize contains a screenshot of the frame window during resizing. Only after a while are the old contents erased by some client window.Īs a consequence, for example, it feels like the status bar of the frame window jumps up and down during resizing. When a window's size is increased during resizing, Windows automatically draws the old contents over the top left part of the window, then sends the WM_WINDOWPOSCHANGED message to the window, which ends up sending WM_SIZE to all the children in addition to a bunch of other messages which take some time to be processed. All frame windows in Windows flicker when they are resized, especially from the top/left corners.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |