Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get Volum number of NetWork Drive
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00335955
Message ID:
00336621
Vues:
24
>Hi,
>I use the WIN32 API function GetVolumeInformation to get serial number of the disk where my application have been instaled. But when the application is installed on network drive this function always returns 0 as a serial number.
>
>Here is my code:
>
>WAIT WINDOW STR(GetVolumNum("P")) && 0

The share may not have a vol/ser number published, since it may bnot be based on the root of a real drive. If you absolutely insist on using this information, use the Drives collection of the Scripting.FileSystemObject; the SerialNumber property of the Drive object is correct if one is published. The following comes from the MSDN Library:


SerialNumber Property Scripting Run-Time Reference
Version 3
--------------------------------------------------------------------------------

Description
Returns the decimal serial number used to uniquely identify a disk volume.
Syntax
object.SerialNumber
The object is always a Drive object.

Remarks
You can use the SerialNumber property to ensure that the correct disk is inserted in a drive with removable media.

this code is adapted from the VB example in the MSDN docs; it illustrates the use of the SerialNumber property:

Function ShowDriveSerialNumber
LPARAMETER cDrvPath
LOCAL fso, oDrive
fso = CREATEOBJ('Scripting.FileSystemObject')
oDrive = fso.GetDrive(fso.GetDriveName(fso.GetAbsolutePathName(cDrvPath)))
RETURN oDrive.SerialNumber
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform