我的程序在单独的线程上有状态窗口。我需要使用新的文本信息信息进行状态线程表更新。这样做的最佳方式是什么?
主线程创建状态窗口:
void CMainWindow::OnPushButtonClicked ()
{
CWinThread* pThread= AfxBeginThread(RUNTIME_CLASS(CMySecondUIThreadClass) );
}
UI线程:
class CMySecondUIThreadClass : public CWinThread
{
DECLARE_DYNCREATE(CMySecondUIThreadClass)
protected:
CMySecondUIThreadClass();
virtual ~CMySecondUIThreadClass();
public:
CMainWindow * v1;
virtual BOOL InitInstance();
virtual int ExitInstance();
protected:
DECLARE_MESSAGE_MAP()
};
UI的InitInstance:
BOOL CMySecondUIThreadClass::InitInstance()
{
v1 = new CMainWindow;
v1->Inform("Thread"); //Procedure that updates vi dialog form controls with text information
m_pMainWnd=v1;
ShowWindow (m_pMainWnd->m_hWnd,SW_SHOW);
m_pMainWnd->UpdateWindow ();
return TRUE;
}