views:

82

answers:

3

I have an only one thread (Windows app) which receives windows and user-defined messages. Right now, when user clicks the mouse and keep pressed the application locks.
How can I resolve this? I have the restriction of one thread.

A: 

Try to see whether are you returning proper value from your wndproc function. If you are not returning proper value, there are chances of application getting locked. I think, in your case WM_LBUTTONDOWN event may not be returning proper value.....

OM
+1  A: 

You can use PeekMessage() with a filter. GetMessage() also allows filtering.

See the MSDN documentation: http://msdn.microsoft.com/en-us/library/ms644943%28VS.85%29.aspx

teambob
+2  A: 

when user clicks the mouse and keep pressed the application locks.

This should not happen in the standard message loop layout.

You cannot block on a received message, if you want to do some long operation (like waiting for the mouse up message).

So I think your problem is the logic in WM_LBUTTONDOWN. Just set a flag, and do not wait for a WM_LBUTTONUP message.

Christopher