Redisplay with WM_PAINT problem

I have a 2D opengl program
I’m reading a special frame from serial port whith a thread and then redraw screen by posting WM_PAINT message.
each frame reading is less than 5 mili second.
problem :
When I read serial with thraed and at the end of frame reading post WM_PAINT message it works, but I can’t receive any another message like keyboard message,for example I want to exit by pressing Esc.

How can I solve this problem?

Sounds like you have not implemented the message loop proper. Can you post the relevant code?