begin process at 2008 07 05 14:57:53
1 205 204 membres
180 nouveaux aujourd'hui
14 119 membres club

Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum.
Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

TESTER SI UN LECTEUR (RESEAU OU NON) EST ACCESSIBLE ET/OU EXISTE


Information sur la source

Catégorie :Fichier / Disque Classé sous : lecteur, reseau, disponible, accessible Niveau : Débutant Date de création : 28/08/2000 Vu / téléchargé: 5 361 / 327

Note :
8 / 10 - par 3 personnes
8,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10

Commentaire sur cette source (5)
Ajouter un commentaire et/ou une note

Description

Test si un lecteur (drive) existe et s'il est accessible.
Cette fonction permet également de tester si un drive réseau non mappé (eg: 'serveurdirectory')est accessible.

Cette fonction utilise la librairie SCRIPTING de Microsoft (SCRRUN.DLL) elle peut donc être utilisée sous VB6 et en ASP.

Source

  • '********************************************************************************************
  • ' Name : xIsDriveReady
  • ' Purpose : Test if a drive is exist and is ready to be used
  • ' Syntax : xIsDriveReady(DriveName)
  • ' Parameters : DriveName : The drive name or full path.
  • ' eg: "c", "c:", "c:windows", or "my computermy directory"
  • ' Return : True is the drive is ready, False if it is not
  • '********************************************************************************************
  • Public Function xIsDriveReady(ByVal DriveName As String) As Boolean
  • Dim objFileSys As Object
  • Dim objDrive As Object
  • Dim strDrive As String
  • On Error GoTo DriveError
  • If Left(DriveName, 1) = "" Then
  • strDrive = DriveName ' If it is a network path, then let it as it is.
  • Else
  • strDrive = Left(DriveName, 1) & ":" ' Create the drive name, to be sure it is in the correct format. eg: "C:"
  • End If
  • Set objFileSys = CreateObject("Scripting.FileSystemObject") ' Create the filesystem object
  • Set objDrive = objFileSys.GetDrive(CStr(strDrive))
  • If objFileSys.DriveExists(strDrive) Then ' Test if the drive exist
  • xIsDriveReady = objDrive.IsReady ' Test if it is ready to be used
  • Else
  • xIsDriveReady = False
  • End If
  • Exit Function
  • DriveError:
  • xIsDriveReady = False
  • End Function
'********************************************************************************************
' Name       : xIsDriveReady
' Purpose    : Test if a drive is exist and is ready to be used
' Syntax     : xIsDriveReady(DriveName)
' Parameters : DriveName : The drive name or full path.
'              eg: "c", "c:", "c:windows", or "my computermy directory"
' Return     : True is the drive is ready, False if it is not
'********************************************************************************************
Public Function xIsDriveReady(ByVal DriveName As String) As Boolean
    Dim objFileSys  As Object
    Dim objDrive    As Object
    Dim strDrive    As String
    
    On Error GoTo DriveError
    
    If Left(DriveName, 1) = "" Then
        strDrive = DriveName                    ' If it is a network path, then let it as it is.
    Else
        strDrive = Left(DriveName, 1) & ":"     ' Create the drive name, to be sure it is in the correct format. eg: "C:"
    End If
    Set objFileSys = CreateObject("Scripting.FileSystemObject")     ' Create the filesystem object
    Set objDrive = objFileSys.GetDrive(CStr(strDrive))
    If objFileSys.DriveExists(strDrive) Then                        ' Test if the drive exist
        xIsDriveReady = objDrive.IsReady                            ' Test if it is ready to be used
    Else
        xIsDriveReady = False
    End If
    Exit Function
    
DriveError:
    xIsDriveReady = False
End Function
Pour les "Membres Club", vous pouvez télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip

  • signaler à un administrateur
    Commentaire de thekingoftheweb le 20/01/2002 16:38:41

    Ya même pa de form

  • signaler à un administrateur
    Commentaire de fabrice69 le 02/05/2002 12:51:27 administrateur CS

    Tout est fait pour l'ajouter a ton projet 'the....', donc il suffit de t'y mettre un peu ca marche parfaitement.
    F___

  • signaler à un administrateur
    Commentaire de Crackers le 18/08/2002 19:05:01

    Tu as parfaitement raison, les petits programmes , modules et autres servent à enrichir nos propres programmes.

  • signaler à un administrateur
    Commentaire de by2k le 05/07/2006 10:43:46

    Avec un peu de retard, merci pour ce bout de code.

  • signaler à un administrateur
    Commentaire de sebkill25 le 18/04/2007 14:20:05

    Slt,
    Une fois que j'ai msi ce code dans un module je fais comment pour l'appeler ?
    Je désire remplir une Combo_box avec les lecteur de disponible sur le pc ...

    Merçi !!!

Ajouter un commentaire

Pub



Appels d'offres

Plugin Dialer outlook
Budget : 2 000€
Travail graphique- ill...
Budget : 1 000€
creation de marque et ...
Budget : 1 000€

CalendriCode

Juillet 2008
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Téléchargements

Logiciels à télécharger sur le même thème :

Boutique

Boutique de goodies CodeS-SourceS