Win32 Window (OpenGL) context displaces everything drawn to it after moving it

  abstraction, c++, opengl, winapi

I have been trying to develop a single header library-ish file that has all the code needed to setup and abstract window creation as well as OpenGL basic type abstraction to the apps needs. Everything has been going smoothly up to now, until I tried to move the window around. The context seems to just glitch out and well the test draw animation I have looping simply deforms and displaces the things that are drawn in the context. I attempted to fix this by adding an animation pause variable that would simply stop the animation when the window is being moved to now avail. I also read about how one should go about handling updates to the context and the actual geometry, and he/she strongly advised a multi-threaded approach to it. I also tried toggling the glSwapBuffers() method with the pause variable to yet again no avail. My Run loop looks something like this:

int Run()
    __int64 t0 = 0;
    __int64 cps = 0;
    float spc = 1.0f / cps;
    MSG msg = { 0 };
    while (WM_QUIT != msg.message)
        if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE))
            __int64 t1 = 0;
            float dt = (t1 - t0) * spc;
            _dt = dt;

            if (!_paused)


            t0 = t1;
        _paused = false;
    return (int)msg.wParam;

Another thing to note here was that whenever I tried to check for the WM_MOVING msg the window would just crash? If anyone could explain why that is would be greatly appreciated as well. One last thing to note here is that I am aware that Windows in a way restricts my window from receiving any messages while I am moving it and I am curious if that is the problem here.

Source: Windows Questions C++