المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Proper way to add item to ListCtrl



C++ Programming
02-13-2010, 09:29 AM
tell me proper way to add an item to ListCtrl.
Here is my code:-
// stdafx.h
#define WM_MYMESSAGE (WM_USER+1)

-------------------------------------------------------

// MyThread.h

class CMyThread : public CWinThread
{
DECLARE_DYNCREATE(CMyThread)
.
.
.
public:
unsigned int f0ll, f1ll, f2ll, f3ll;
unsigned int f0ul, f1ul, f2ul, f3ul;

public:
afx_msg void MyMessageHandler(WPARAM, LPARAM);

-------------------------------------------------------

// MyThread.cpp
.
.
.
afx_msg void CMyThread::MyMessageHandler(WPARAM, LPARAM)
{
// I have to add an item to ListCtrl here
}
BEGIN_MESSAGE_MAP(CMyThread, CWinThread)
ON_THREAD_MESSAGE(WM_MYMESSAGE, MyMessageHandler)
END_MESSAGE_MAP()

-------------------------------------------------------

// IPMDlg.cpp
.
.
.
void CIPMDlg::OnBnClickedB*******devices()
{
.
.
.
p*******Thread = AfxBeginThread(RUNTIME_CLASS(CMyThread));
p*******Thread->PostThreadMessage(WM_MYMESSAGE, 0, 0);
}
Future Lies in Present.
Manmohan Bishnoi