///////////////////////////////////////////////////////////////////////////// // clientDlg.cpp : Implementation of CclientDlg #include "stdafx.h" #include #include "clientDlg.h" extern HWND hDlg; // handle to dialog window, written in client.cpp ///////////////////////////////////////////////////////////////////////////// // Thread Processing Function void __cdecl doReply(void* idThread) { while(1) { Sleep(6000); if(hDlg) PostMessage(hDlg,WM_USER_EVENT,0,0); } } ///////////////////////////////////////////////////////////////////////////// // CclientDlg handler for user defined message LRESULT CclientDlg:: OnUserMsg(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) { static unsigned int count = 0; ++count; std::ostringstream temp; temp << "event count = " << count << std::ends; std::string temper = temp.str(); const char *temps = temper.c_str(); HWND hwndLB = GetDlgItem(IDC_LIST1); SendMessage(hwndLB,LB_ADDSTRING,0,(LPARAM)temps); return 1; }