sjcguy
January 10th, 2005, 03:34 PM
Hi,
Reading from the FAQ about accessing UI from the worker thread. I'd like to follow the recommendation but my thread function is going to call many other functions and they also need to put out status message on the screen ( CListCtrl).
So my question is: can I declare this as global?
HWND *phObjectHandle;
and then do whenever I create a thread
HWND *phObjectHandle = new HWND;
*phObjectHandle = GetSafeHwnd();
and delete it when I terminate the thread?
thanks.
Also ther question which one is better practice?
1. Create global buffer and whenever I want to print something on the screen. print to the buffer and send message to the main dialog
2. do a new CString and then pass with ::PostMessage and delete it in the main thread.
thanks.
Reading from the FAQ about accessing UI from the worker thread. I'd like to follow the recommendation but my thread function is going to call many other functions and they also need to put out status message on the screen ( CListCtrl).
So my question is: can I declare this as global?
HWND *phObjectHandle;
and then do whenever I create a thread
HWND *phObjectHandle = new HWND;
*phObjectHandle = GetSafeHwnd();
and delete it when I terminate the thread?
thanks.
Also ther question which one is better practice?
1. Create global buffer and whenever I want to print something on the screen. print to the buffer and send message to the main dialog
2. do a new CString and then pass with ::PostMessage and delete it in the main thread.
thanks.