quarta-feira, 22 de maio de 2013

C++ | Outra forma de obter a letras das drives (discos) ligados


//Função para devolver as letras dos discos no Windows
void DevolveLetrasDrives()
{
    try
      {
         array<String^>^drives = System::IO::Directory::GetLogicalDrives();
         //array<String^>^drivetype = GetDriveType();

         for ( int i = 0; i < drives->Length; i++ )
         {

        //System::Console::WriteLine( drives[ i ] );
        MessageBox::Show(drives[ i ],
         "My Application", MessageBoxButtons::OKCancel,
         MessageBoxIcon::Asterisk);
         }
      }
      catch ( System::IO::IOException^ )
      {
         System::Console::WriteLine(  "An I/O error occurs." );
      }
      catch ( System::Security::SecurityException^ )
      {
         System::Console::WriteLine(  "The caller does not have the HelloServer'  required permission." );
      }
}



Veja aqui outra forma semelhante para obter as drives do Windows.

Sem comentários:

Enviar um comentário