startthread get called to launch to update list box.
a)is it the only way to pass string to the PostMessage?. my concern is that allocate using new in each iteration each time slows it down a bit.
b)does OnAddToListBox look memory leak free?.
c)What is the best way handle m_pThread at the end?. Anyway to improve it?.

Code:
UINT CMyDlg::Dump(LPVOID lparam)   
{  
     HWND *pHndl = static_cast<HWND *>(lparam);
     char buffer[200];
     for (int i = 0; i < 100; i++)
     {
	sprintf_s(buf,"user %d, data %s",i, "Connected");
	::PostMessage(*pHndl, UWM_ADD_To_LBox, 0, (WPARAM)(new CString(buffer)));
     }
     delete pHndl;
}

void CMyDlg::startthread(LPVOID lparam)  
{
	HWND *pHndl = new HWND;
	*pHndl = GetSafeHwnd();
	m_pThread = AfxBeginThread(Dump, pHndl);
}

LRESULT CMyDlg::OnAddToListBox(WPARAM wParam,LPARAM lParam) 
{
	std::auto_ptr<CString> text(reinterpret_cast<CString*>(lParam));
  	m_listbox.AddString(*text);
  	m_listbox.RedrawWindow();
  	return 0;
}