This problem has been resolved. The solution involved replacing "PeekMessage(&msg, hWnd, WM_KEYFIRST, 0, 0, PM_REMOVE)" with "PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)". The reason I did not think it was the solution before was that I was also throwing an access exception (in a different part of...