Getting disk volume
am 10.01.2008 07:31:16 von u39077
Hi,
I have used CreateObject("Scripting.FileSystemObject") to get the disk volume.
Is there any other way of get the disk volume other than using the FSO.
Thanks
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-ac cess/200801/1
Re: Getting disk volume
am 10.01.2008 07:56:10 von John Mishefske
Benjamins via AccessMonster.com wrote:
> I have used CreateObject("Scripting.FileSystemObject") to get the disk volume.
> Is there any other way of get the disk volume other than using the FSO.
Yes, Windows provides an API for programming languages to interact with
the operating system.
The disk's volume name? or the disk's serial number?
http://www.freevbcode.com/ShowCode.Asp?ID=44
this next site uses the API declarations from the above link and returns
the serial number:
http://www.vb-helper.com/howto_volume_info.html
I haven't verified either - just did a quick Goggle search.
--
'--------------------------
' John Mishefske
' UtterAccess Editor
' Microsoft MVP 2007, 2008
'--------------------------
Re: Getting disk volume
am 10.01.2008 07:59:43 von Allen Browne
See:
http://vbnet.mvps.org/index.html?code/disk/index.html
The site contains lots of API calls that work with VB. You should be able to
grab the one you need.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Benjamins via AccessMonster.com" wrote in message
news:7dfcc9c1e6545@uwe...
> Hi,
>
> I have used CreateObject("Scripting.FileSystemObject") to get the disk
> volume.
> Is there any other way of get the disk volume other than using the FSO.
Re: Getting disk volume
am 10.01.2008 08:21:56 von Stuart McCall
"Benjamins via AccessMonster.com" wrote in message
news:7dfcc9c1e6545@uwe...
> Hi,
>
> I have used CreateObject("Scripting.FileSystemObject") to get the disk
> volume.
> Is there any other way of get the disk volume other than using the FSO.
>
> Thanks
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-ac cess/200801/1
You can retrieve this info from the windows API. Paste the following code
into a new module:
Private Declare Function GetVolumeInformation Lib "Kernel32" _
Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, _
ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, _
lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, _
lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, _
ByVal nFileSystemNameSize As Long) As Long
Public Function DriveSerial(DriveLetter As String) As String
Dim Serial As Long, dummy As String
dummy = String$(255, Chr$(0))
GetVolumeInformation DriveLetter & ":\", _
dummy, 255, Serial, 0, 0, dummy, 255
DriveSerial = CStr(Serial)
End Function
Then call like this:
Debug.Print DriveSerial("C")
Re: Getting disk volume
am 11.01.2008 00:13:07 von Chuck Grimsby
Dir$("C:\",vbVolume)
Replace the "C:\" with whatever drive you like.
(Warning: Disk Volumes don't always have names......)
On Thu, 10 Jan 2008 06:31:16 GMT, "Benjamins via AccessMonster.com"
wrote:
>Hi,
>
>I have used CreateObject("Scripting.FileSystemObject") to get the disk volume.
>Is there any other way of get the disk volume other than using the FSO.
>
>Thanks
---
Please Post Any Replies To This Message Back To the Newsgroup.
There are "Lurkers" around who can benefit by our exchange!