void KeepRxPacket(void *buffer, ULONG serial) { void *p; if (QueueOfRxPackets.Lookup(serial, p)) { FailCase("[%s] - packet %d already exists!", __FUNCTION__, serial); QueueOfRxPackets.RemoveKey(serial); } QueueOfRxPackets.SetAt(serial, buffer); }
void *GetRxPacket(ULONG serial) { void *p = NULL; if (QueueOfRxPackets.Lookup(serial, p)) { QueueOfRxPackets.RemoveKey(serial); return p; } else { FailCase("[%s] - packet %d does not exist!", __FUNCTION__, serial); return NULL; } }
// Cleanup the tray items for the passed document. void DestroyDocumentWorkspace(AcApDocument *pDoc) { if(!documentTrayMap.RemoveKey(pDoc)) AfxMessageBox(_T("Couldn't remove tray item from the document map")); AcApStatusBar *pStatusBar=pDoc->drawingStatusBar(); AcTrayItem* pTrayItem = NULL; if(pStatusBar) { // Remove all tray items that we added in this sample. int count = pStatusBar->GetTrayItemCount(); int iPos = 0; for(int i = 0; i<count; i++) { pTrayItem = pStatusBar->GetTrayItem(iPos); if(pTrayItem) { CString ttt; pTrayItem->GetToolTipText(ttt); if( ttt.Compare(_T("World Icon ToolTip")) == 0 || ttt.Compare(_T("Pie Icon ToolTip")) == 0 || ttt.Compare(_T("Tree Icon ToolTip")) == 0 ) { pStatusBar->Remove(pTrayItem); delete pTrayItem; } else iPos++; } } // Remove all pane items from the status bar. AcPane *pPane=NULL; count = pStatusBar->GetPaneCount(); iPos = 0; for(int i=0;i<count; i++) { pPane=pStatusBar->GetPane(iPos); if(pPane) { CString ttt; pPane->GetToolTipText(ttt); if( ttt.Compare(_T("Pane Item Tooltip")) == 0 || ttt.Compare(_T("Pane Icon Item Tooltip")) == 0 ) { pStatusBar->Remove(pPane); delete pPane; } else iPos++; } } // Remove the context menu pane. // Note this will make the context menu empty and there is no way to recover the previous // default menu. Therefore, a better way is to make this app as unloadable (lock it). // If the app is locked, there is no need to remove it with the line below as // AutoCAD will clean up when it quits. pStatusBar->SetStatusBarMenuItem(NULL); } }