473,396 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Getting disk volume

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/For...ccess/200801/1

Jan 10 '08 #1
4 3122
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
'--------------------------
Jan 10 '08 #2
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" <u39077@uwewrote 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.
Jan 10 '08 #3
"Benjamins via AccessMonster.com" <u39077@uwewrote 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/For...ccess/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")
Jan 10 '08 #4

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"
<u39077@uwewrote:
>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!
Jan 10 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Rob | last post by:
Hello, I've a couple of questions on setting up my lovely new server... I've decided on R1 (2*36GB) for the OS, R1 (2*73GB) primarily for the Log Files and R5 (5*73GB) for the Data files. I was...
0
by: pshroads | last post by:
I am trying to restore a 200 GB database on to a newly formatted SAN volume. The restore has been running for hours but there doesn't seem to be a lot of disk activity on the disks I'm restoring to...
3
by: Jefe | last post by:
Hi group I'm trying to implement a console application which work just lie "Dir" instruction in MS-Dos prompt window so I need to display Volume Serial Number and also the free space, how can I...
2
by: mikeybe | last post by:
Anyone know how to return the disk number (i.e. the number you see when you launch windows disk manager and see your drives numbered disk 0, disk 1, etc.)? I'm not talking about the volume serial...
1
by: Tomaz Koritnik | last post by:
I need to add a virtual disk volume to the windows. In the foreground, data will be presented in a form of a disk drive so users can access it using explorer but in the background, data will be...
13
by: ragtag99 | last post by:
I posted this on comp.lang.asm.x86, alt.os.development, comp.arch, comp.lang.c++ Im working with windows xp professional, NTFS and programming with MASM, c++ (free compiler) or visual basic 6.0...
1
devonknows
by: devonknows | last post by:
I was wondering if any of you vb guru's can help me with this, im buildign a simple computer monitor that monitors vcertain aspects of the machine, page file usage, physcial memory, logical drive...
3
by: nospam | last post by:
I am trying to monitor the process of a file being copied, but I cannot find a function that will return the actual file size, not the total file size, as reported by fileinfo.length. Has anyone...
2
by: sachin30 | last post by:
hi is it possible to get all volume in dynamic disk.? i have two disk one is basic and other one is dynamic(os - windows server 2003 ent edition) i just want all volumes information on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.