CWaitCursor doesnot work in thread function
-
Hai all, CWaitCursor does not work in thread function.How can I change my cursor while i do some lengthy process. Please help me. Thanks to all
-
Hai all, CWaitCursor does not work in thread function.How can I change my cursor while i do some lengthy process. Please help me. Thanks to all
Post a message to the main thread and let it to do the stuff. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
Post a message to the main thread and let it to do the stuff. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarkeplease clarify , what mwessage and param that i used in Postmemessage
-
please clarify , what mwessage and param that i used in Postmemessage
Typically you do something like
#define WM_MY_CHANGE_CURSOR (WM_APP+1)
In a header file included both by your main thread source file and by the worker thread one. Then, when appropriate (whenever you need to change the cursor), send the message from the worker thread to the main one, for instance
PostMessage(hWnd, WM_MY_CHANGE_CURSOR, wParam, lParam);
Where
hWnd
is the handle of the main window andwParam, lParam
meanings are freely choosen by you (e.g. wParam maybe the index of the intended new cursor). Finally, you properly handle the message (to do the graphics stuff) in the main thread, for instance usingMFC
ON_MESSAGE
mechanism (see [^]). :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke