示例#1
0
static BOOL FillDriveList()
{
    DRIVE_INFO di;

    TCHAR chDrive = TEXT('A');
    DWORD dwDrives = GetLogicalDrives();

    // This failing is not fatal to this function
    // Make sure the partition table is up to date
    afs_status_t nStatus;
    int nResult = ReadPartitionTable(&nStatus);
    ASSERT(nResult);

    while (dwDrives) {
	if (dwDrives & 1) {
	    memset(&di, 0, sizeof(di));

	    if (GetDriveInfo(chDrive, di)) {
		FASTLISTADDITEM ai = { 0, di.nImage, IMAGE_NOIMAGE, di.szRootDir, di.bDisabled, di.dwFlags };
		HLISTITEM hItem = FastList_AddItem(m_hDriveList, &ai);
		FastList_SetItemText(m_hDriveList, hItem, 1, di.szVolName);
		FastList_SetItemText(m_hDriveList, hItem, 2, di.szSize);
	    }
	}

	chDrive++;
	dwDrives >>= 1;
    }

    return TRUE;
}
示例#2
0
void CellEdit_AddServerEntry (HWND hDlg, PCELLDBLINE pLine, int iOrder)
{
   HWND hList = GetDlgItem (hDlg, IDC_LIST);

   PCELLDBLINE pCopy = New (CELLDBLINE);
   memcpy (pCopy, pLine, sizeof(CELLDBLINE));
   pCopy->pPrev = NULL;
   pCopy->pNext = (PCELLDBLINE)iOrder;

   CELLDBLINEINFO Info;
   CSDB_CrackLine (&Info, pCopy->szLine);

   TCHAR szServer[ cchRESOURCE ];
   lstrcpy (szServer, inet_ntoa (*(struct in_addr *)&Info.ipServer));

   FASTLISTADDITEM ai;
   memset (&ai, 0x00, sizeof(ai));
   ai.iFirstImage = IMAGE_NOIMAGE;
   ai.iSecondImage = IMAGE_NOIMAGE;
   ai.pszText = Info.szComment;
   ai.lParam = (LPARAM)pCopy;
   HLISTITEM hItem = FastList_AddItem (hList, &ai);

   FastList_SetItemText (hList, hItem, 1, szServer);
}
示例#3
0
void ShowDriveList(HWND hDlg, DRIVEMAPLIST& drives)
{
   // Prepare the columns
   HWND hList = GetDlgItem (hDlg, IDC_GLOBAL_DRIVE_LIST);

   // Fill in the list of drives
   FastList_Begin (hList);

   FastList_RemoveAll(hList);

   for (size_t ii = 0; ii < 26; ++ii) {
      if (!GlobalDrives.aDriveMap[ ii ].chDrive)
         continue;

      HWND hList = GetDlgItem (hDlg, IDC_GLOBAL_DRIVE_LIST);

   	FASTLISTADDITEM ai;
   	memset (&ai, 0x00, sizeof(FASTLISTADDITEM));
   	ai.iFirstImage = IMAGE_NOIMAGE;
   	ai.iSecondImage = IMAGE_NOIMAGE;
   	// There must be DRIVE_LETTER_INDEX number of spaces before the ? character
   	ai.pszText = _tcsdup(TEXT("  ?:"));
   	ai.pszText[DRIVE_LETTER_INDEX] = GlobalDrives.aDriveMap[ ii ].chDrive;
   	ai.lParam = 0;

   	HLISTITEM hItem = FastList_AddItem (hList, &ai);

      TCHAR szAfsPath[ MAX_PATH ];
      AdjustAfsPath (szAfsPath, GlobalDrives.aDriveMap[ ii ].szMapping, TRUE, FALSE);

   	FastList_SetItemText (hList, hItem, 1, szAfsPath);
   }

   FastList_End (hList);
}
示例#4
0
文件: action.cpp 项目: bagdxk/openafs
void Actions_Refresh (void)
{
   size_t nItems = 0;
   TCHAR szText[ cchRESOURCE ];

   HWND hList;
   if ((hList = GetDlgItem (l.hAction, IDC_ACTION_LIST)) != NULL)
      {
      LPARAM lpOld = FL_StartChange (hList, TRUE);

      if (l.pActionList)
         {
         for (size_t ii = 0; ii < l.pActionList->cEntries; ++ii)
            {
            LPTSTR pszDesc;
            if ((pszDesc = GetActionDescription (&l.pActionList->aEntries[ ii ].Action)) != NULL)
               {
               SYSTEMTIME st;
               TicksToElapsedTime (&st, GetTickCount() - l.pActionList->aEntries[ ii ].Action.csecActive);
               FormatElapsed (szText, TEXT("%s"), &st);

               FASTLISTADDITEM flai;
               memset (&flai, 0x00, sizeof(flai));
               flai.hParent = NULL;
               flai.iFirstImage = IMAGE_NOIMAGE;
               flai.iSecondImage = IMAGE_NOIMAGE;
               flai.pszText = pszDesc;
               flai.lParam = (LPARAM)ii;
               flai.dwFlags = FLIF_DISALLOW_SELECT;

               HLISTITEM hItem;
               if ((hItem = FastList_AddItem (hList, &flai)) != NULL)
                  FastList_SetItemText (hList, hItem, 1, szText);

               ++nItems;

               FreeString (pszDesc);
               }
            }
         }

      FL_EndChange (hList, lpOld);
      }

   if (nItems == 0)
      GetString (szText, IDS_ACTION_DESC_NONE);
   else if (nItems == 1)
      GetString (szText, IDS_ACTION_DESC_ONE);
   else // (nItems >= 2)
      GetString (szText, IDS_ACTION_DESC_MULT);
   SetDlgItemText (l.hAction, IDC_ACTION_DESC, szText);
}
示例#5
0
void CellEdit_OnEdit (HWND hDlg)
{
   HWND hList = GetDlgItem (hDlg, IDC_LIST);
   HLISTITEM hItem = FastList_FindFirstSelected (hList);
   PCELLDBLINE pInfo = (PCELLDBLINE)FastList_GetItemParam (hList, hItem);

   CELLDBLINE Line;
   memcpy (&Line, pInfo, sizeof(CELLDBLINE));

   if (ModalDialogParam (IDD_SERVER_EDIT, hDlg, (DLGPROC)ServerEdit_DlgProc, (LPARAM)&Line) == IDOK)
      {
      CELLDBLINEINFO Info;
      CSDB_CrackLine (&Info, Line.szLine);

      TCHAR szServer[ cchRESOURCE ];
      lstrcpy (szServer, inet_ntoa (*(struct in_addr *)&Info.ipServer));

      FastList_SetItemText (hList, hItem, 0, Info.szComment);
      FastList_SetItemText (hList, hItem, 1, szServer);

      lstrcpy (pInfo->szLine, Line.szLine);
      }
}