0

I want to get the hard disk partitions,their individual storage capacity and used space. Then display it in some control(List control would be better). I am using MFC to do this. I have searched online and managed to pull of the partitions. But I managed to display it in an edit box only.

    void CDiskManagementClientDlg::OnBnClickedOk()
    {
       wchar_t drive[512]=L"A:";
       unsigned int drives=GetLogicalDrives();
       CString strListOfDrives=_T("The drives are:");
       if(drives==0)
       {
         AfxMessageBox(_T("No Partitions"));
       }
       else
       {
        while(drives)
       {
        if(drives & 1)
        {
            strListOfDrives+=drive;
            strListOfDrives+=_T(", ");
        }
        drive[0]++;
        drives>>=1;
        }
        m_newDrives=strListOfDrives;
        UpdateData(FALSE);
       }
    } 

This is the code I have used to display the partions in an edit box when a button is clicked. I want to display the partitions in a control. Can someone pls guide me?

xMRi
  • 14,982
  • 3
  • 26
  • 59
  • Possible duplicate http://stackoverflow.com/questions/4042212/ – xMRi May 25 '15 at 09:42
  • 1
    The documentation for [List Box](https://msdn.microsoft.com/en-us/library/windows/desktop/bb775146.aspx) and [List View](https://msdn.microsoft.com/en-us/library/windows/desktop/bb774737.aspx) contains exhaustive information on how to use the respective controls. – IInspectable May 25 '15 at 11:04

0 Answers0