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?