记录一个问题, 过几天在查找原因,
开始构建了一个多边形Ptr对象, 然后通过PostThreadMessage传递给线程中的响应函数OnSpatialQuery 可 lParam的值却为“1”。 不知道怎么回事
// 构造查询多边形
IPolygonPtr pPoly;
GetQueryPolygon(&pPoly);
CNearResTree *pNRTree = &m_Tree;
m_pSptialQueryThread = (CSpatialQueryThread*)AfxBeginThread(RUNTIME_CLASS(CSpatialQueryThread));
m_pSptialQueryThread->PostThreadMessage(WM_SPATIALQUERY,(WPARAM)pNRTree,(LPARAM)pPoly);
m_pSptialQueryThread->PostThreadMessage( WM_QUIT, NULL, NULL);
LONG CSpatialQueryThread::OnSpatialQuery(WPARAM wParam,LPARAM lParam)
{
CNearResTree* pNRTree = (CNearResTree*)wParam;
IPolygon* pRawPolygon = (IPolygon*)lParam;
HTREEITEM hRoot = pNRTree->GetRootItem();
stException *pExp = NULL;
CoInitialize(NULL);
pNRTree->Search(hRoot,pRawPolygon,&pExp);
CoUninitialize();
return 0;
}