473,545 Members | 1,878 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting disk volume

Hi,

I have used CreateObject("S cripting.FileSy stemObject") 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.c om
http://www.accessmonster.com/Uwe/For...ccess/200801/1

Jan 10 '08 #1
4 3134
Benjamins via AccessMonster.c om wrote:
I have used CreateObject("S cripting.FileSy stemObject") 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.c om" <u39077@uwewrot e in message
news:7dfcc9c1e6 545@uwe...
Hi,

I have used CreateObject("S cripting.FileSy stemObject") 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.c om" <u39077@uwewrot e in message
news:7dfcc9c1e6 545@uwe...
Hi,

I have used CreateObject("S cripting.FileSy stemObject") 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.c om
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 GetVolumeInform ation Lib "Kernel32" _
Alias "GetVolumeInfor mationA" (ByVal lpRootPathName As String, _
ByVal lpVolumeNameBuf fer As String, ByVal nVolumeNameSize As Long, _
lpVolumeSerialN umber As Long, lpMaximumCompon entLength As Long, _
lpFileSystemFla gs As Long, ByVal lpFileSystemNam eBuffer As String, _
ByVal nFileSystemName Size As Long) As Long

Public Function DriveSerial(Dri veLetter As String) As String
Dim Serial As Long, dummy As String
dummy = String$(255, Chr$(0))
GetVolumeInform ation 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:\",vbVo lume)

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.c om"
<u39077@uwewrot e:
>Hi,

I have used CreateObject("S cripting.FileSy stemObject") 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
1892
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 wondering if I could increase performance by partitioning off/ creating a new volume on my log array and placing on there the tempdb and possibly...
0
1280
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 and I'm wondering if that's anything to worry about. Using perfmon I'm monitoring the % Disk time for the disk I'm restoring to. It will show...
3
4158
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 get Volume Serial Number and other related informations and is there any function in .Net which will return the available free space in a specified...
2
2291
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 number or drive serial number. For example, I want to programatically determine what disk number the c drive is using vb.net and windows 2000. ...
1
2811
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 read from FTP server an not actual disk. I don't wanna write a driver but are there existing facilities somewhere that allow me to do this with C#? Any...
13
4835
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 === question 1 Primarily Im trying to design a program that has full control over a hard disk. What it needs to do is find out what sectors...
1
1663
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 data n such, i wondering can any of you help me in getting a volume name if possible i have a guess it is GetVolumeInformation with the api, but im...
3
3452
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 ever done something like this before? I would rather do this instead of trying to open the file exclusively.
2
1673
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 dynamic disk is any API in c++ that return all volume in dynamic disk? Thanks in advancce
0
7486
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7416
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7442
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6001
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5347
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3456
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1905
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1032
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
729
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.