• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 162
  • Last Modified:

Drives Information immediate

I have used the following code and get the infomation about a drive.Please tell me how i can get all drives and their information.I require some code.

DWORD Check,strLen;
char buffer[30];
Check=GetLogicalDriveStrings(10,buffer);
AfxMessageBox(buffer);
0
malik_mumtaz
Asked:
malik_mumtaz
1 Solution
 
Vinayak KumbarSr Program ManagerCommented:
Hi,

Do This

DWORD Check;
    char buffer[30];
      CStringArray l_saDrives;
    Check=GetLogicalDriveStrings(20,buffer);
      char chTemp[10];
      ZeroMemory(chTemp, 10);
      int Count = 0;
      for(int i = 0; i < Check; i++)
      {
            if(buffer[i] == 0)
            {
                  l_saDrives.Add(chTemp);
                  ZeroMemory(chTemp, 10);
                  Count = 0;
            }
            else
                  chTemp[Count++] = buffer[i];
            
      }
   
      for(i = 0; i < l_saDrives.GetSize(); i++)
      {
            AfxMessageBox(l_saDrives[i]);
      }

Hope this helps.
VinExpert
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now