1 最简单的,在RELEASE中即可通过
2 没有试过,网上的方法:
引用:http://hi.baidu.com/leonardhuang/blog/item/d5fa133f814777cc9e3d62ee.html
1.定义一个消息 #define WM_UPDATE_MESSAGE (WM_USER+200)
2.定义消息映射
BEGIN_MESSAGE_MAP(CCServerDlg, CDialog)
//{{AFX_MSG_MAP(CCServerDlg)
...
ON_MESSAGE(WM_UPDATE_MESSAGE, OnUpdateMessage)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
3. 定义消息处理函数
// Generated message map functions
//{{AFX_MSG(CCServerDlg)
...
afx_msg LRESULT OnUpdateMessage(WPARAM wParam, LPARAM lParam);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
4. 完成函数内容,只需调用UpdateData()即可
LRESULT CXXXDlg::OnUpdateMessage(WPARAM wParam, LPARAM lParam)
{
UpdateData(false);
return 0;
}
5.线程中的调用
UINT CXXXDlg::ClientThread(LPVOID lpParam)
{
CXXXDlg *pt=(CCServerDlg*)CWnd::FromHandle(((CCServerDlg*)lpParam)->m_hWnd);//get the handle to post message
pt->PostMessage(WM_UPDATE_MESSAGE,0,0);//OK - UpdateDate
//message sended to "pt"
...
}
6.程序中调用
// CWinThread* pThread;
// static UINT ClientThread(LPVOID lpParm);
void CCServerDlg::OnSStart()
{
...
pThread=AfxBeginThread(ClientThread,this);
...
}