void CellEdit_OnRemove (HWND hDlg) { HWND hList = GetDlgItem (hDlg, IDC_LIST); FastList_Begin (hList); HLISTITEM hItem; while ((hItem = FastList_FindFirstSelected (hList)) != NULL) { PCELLDBLINE pInfo = (PCELLDBLINE)FastList_GetItemParam (hList, hItem); Delete (pInfo); FastList_RemoveItem (hList, hItem); } FastList_End (hList); }
void Server_Hosts_OnDelEntry (HWND hDlg, LPSVR_HOSTS_PARAMS lpp) { HWND hList = GetDlgItem (hDlg, IDC_HOST_LIST); FL_StartChange (hList, FALSE); HLISTITEM hItem; while ((hItem = FastList_FindFirstSelected (hList)) != NULL) { size_t iEntry = (size_t)FL_GetData (hList, hItem); AfsClass_HostList_DelEntry (lpp->lpList, iEntry); FastList_RemoveItem (hList, hItem); } FL_EndChange (hList); }
void AutoMap_OnRemove (HWND hDlg) { HLISTITEM hItem; HWND hList = GetDlgItem (hDlg, IDC_GLOBAL_DRIVE_LIST); DRIVEMAP *pDrive = GetSelectedDrive(hDlg, &hItem); if (pDrive == 0) return; if (DefineDosDrive(pDrive, DDD_REMOVE)) { RemoveFromDriveList(GlobalDrives, *pDrive); FastList_RemoveItem (hList, hItem); } AutoMap_OnSelect(hDlg); }
void Display_OnEndTask_UpdMachines (LPTASKPACKET ptp) { HWND hDlg = GetTabChild (GetDlgItem (g.hMain, IDC_TAB)); HWND hList = GetDlgItem (hDlg, IDC_MACHINES_LIST); if (IsWindow (hList) && !lstrcmpi (TASKDATA(ptp)->szPattern, g.szPatternMachines)) { FastList_Begin (hList); // Update the title above the list to indicate what we're showing // TCHAR szCell[ cchRESOURCE ]; asc_CellNameGet_Fast (g.idClient, g.idCell, szCell); LPTSTR pszTitle = FormatString ((TASKDATA(ptp)->szPattern[0]) ? IDS_MACHINES_PATTERN : IDS_MACHINES_ALL, TEXT("%s"), szCell); SetDlgItemText (hDlg, IDC_MACHINES_TITLE, pszTitle); FreeString (pszTitle); // For faster access, we'll want to use a hashlist to deal with // the items in our ASIDLIST (right now it's just a flat array). // This lets us remove duplicates--which is no big deal because // there shouldn't be any anyway--but more importantly it lets // us instantly determine if a particular ASID is in the list // (the asc_AsidListTest function is O(n), and we need O(1)). // LPHASHLIST pAsidList = New (HASHLIST); if (TASKDATA(ptp)->pAsidList) { for (size_t iAsid = 0; iAsid < TASKDATA(ptp)->pAsidList->cEntries; ++iAsid) pAsidList->AddUnique ((PVOID)(TASKDATA(ptp)->pAsidList->aEntries[ iAsid ].idObject)); } // Delete any items which are currently in the FastList but // which aren't in our AsidList. // HLISTITEM hItemNext; for (HLISTITEM hItem = FastList_FindFirst (hList); hItem; hItem = hItemNext) { hItemNext = FastList_FindNext (hList, hItem); ASID idObject = (ASID)FastList_GetItemParam (hList, hItem); if (!pAsidList->fIsInList ((PVOID)idObject)) FastList_RemoveItem (hList, hItem); } // Add items for any entries which are in our AsidList but aren't // currently in the FastList. // DWORD dwStyle = GetWindowLong (hList, GWL_STYLE); for (LPENUM pEnum = pAsidList->FindFirst(); pEnum; pEnum = pEnum->FindNext()) { ASID idObject = (ASID)( pEnum->GetObject() ); HLISTITEM hItem; if ((hItem = FastList_FindItem (hList, (LPARAM)idObject)) == NULL) { FASTLISTADDITEM ai; memset (&ai, 0x00, sizeof(ai)); Display_GetImageIcons (dwStyle, gr.ivMch, idObject, imageSERVER, IMAGE_NOIMAGE, &ai.iFirstImage, &ai.iSecondImage); ai.lParam = (LPARAM)idObject; hItem = FastList_AddItem (hList, &ai); } } Delete (pAsidList); FastList_End (hList); } Display_StopWorking(); }