Hi, I use the Xtreme toolkit in my applacation. Now I have one problem long time.
In my applacation, I create two DcokPane,
In the first Pane(pMyList), I added my CMyListCtrl object (CMyListCtrl calss is a CListctrl derived class), other pane(pFormView) I attach my CMyFormView object which derived CFormView. And i create on thread func.
In my CMyFormView, I add one Data Members m_ImgTree, it is one CMyImgTree control object. CMyImgTree is a CTreeCtrl derived class.
In CMyListCtrl, I add one custom message with ON_REGISTERED_MESSAGE macros. In my thread func i use PostMessage func post my custom message to CMyListCtrl. it work well.
Now i want send data to CMyImgTree object, so i add custom message with ON_REGISTERED_MESSAGE macros in CMyFormView again. And In CMyListCtrl class custom message func I add PostMessage for sending data to CMyFormView, but it has one problem. It worked awfully.
There no any data in the pFormView and the pMyList. And the applacation halt, i must stop it in vs2008. But the CMyListCtrl object scrollbar was moved buttom, so it should have data which no appeared.
How solve the problem?
the code like this
void CapThreadFunc() { HRESULT hs;
while ( (( hs = pcap_next_ex( (pcap_t*) adhandle, &header,(const unsigned char**)&pkt_dataSource ) ) >= 0)&&bRun ) { ::PostMessage(((CMyListCtrl*)(&((CMainFrame*)(AfxGetApp()->m_pMainWnd))->m_PacketInfoList))->m_hWnd,WM_GETDATAFROMTHREAD,0,0); } }
LRESULT CMyListCtrl::OnGetDataFromTread(WPARAM wParam, LPARAM lParam) {
MY FUNC CODE;
if(my codition)
{
CMainFrame* pMainFrame = (CMainFrame*)(AfxGetApp()->m_pMainWnd); CXTPDockingPane* pImgInfoPane = pMainFrame->m_paneManager.FindPane(IDR_IMG_TREEPANE); CMyFormView* pImgInfoTree = (CMyFormView*)pImgInfoPane->GetChild(); ::PostMessage(pImgInfoTree->m_hWnd,WM_GETDATAFROMTHREADIMGTREE,0,0);
}
LRESULT CMyFormView::OnGetDataFromTread( WPARAM wParam, LPARAM lParam ) { my func code;
return x; }
}
Thanks.
|