473,396 Members | 1,764 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.

How to remove Volume Name on removable drive?

Hi all,

I have an application that can use many different compact-flash cards as
storage for different jobs the client is working on. I have added a
function to erase all files from a flash card, and that works fine.

But I would also like to be able to make the Volume Label on each flash card
the job name its files belong to. I can't work out how to either write the
Volume Label to the cards, or to remove it when I erase them. I did this
in VB5 by using a Windows API call - surely VB.NET 2003 is smarter than
that?

Anybody know the "right" way to do this in VB.NET?

Thanks
Feb 27 '06 #1
6 2658
CMM
I don't think there's a framework (or VB) way to do it.... but
SetVolumeLabel(...) is such an easy API to call... just use that. What's the
big deal? Alternatively, you can also spawn a Label command using
Process.Start("cmd.exe", "/C label drive:label"). Change /C to /K to keep
the window around for debugging purposes. /C dismisses the command prompt
window as soon the command finishes.

But, really, it doesn't get any easier than SetVolumeLabel API AFAIK.

--
-C. Moya
www.cmoya.com

"Steve Marshall" <st*****@westnet.net.au> wrote in message
news:11**************@quartz.westnet.net.au...
Hi all,

I have an application that can use many different compact-flash cards as
storage for different jobs the client is working on. I have added a
function to erase all files from a flash card, and that works fine.

But I would also like to be able to make the Volume Label on each flash
card the job name its files belong to. I can't work out how to either
write the Volume Label to the cards, or to remove it when I erase them.
I did this in VB5 by using a Windows API call - surely VB.NET 2003 is
smarter than that?

Anybody know the "right" way to do this in VB.NET?

Thanks

Feb 27 '06 #2
Yes, that's what I've done. To remove the label I just set it to an empty
string, which also seems to have the desired effect.

Thanks for the reply.
"CMM" <cm*@nospam.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I don't think there's a framework (or VB) way to do it.... but
SetVolumeLabel(...) is such an easy API to call... just use that. What's
the big deal? Alternatively, you can also spawn a Label command using
Process.Start("cmd.exe", "/C label drive:label"). Change /C to /K to keep
the window around for debugging purposes. /C dismisses the command prompt
window as soon the command finishes.

But, really, it doesn't get any easier than SetVolumeLabel API AFAIK.

--
-C. Moya
www.cmoya.com

"Steve Marshall" <st*****@westnet.net.au> wrote in message
news:11**************@quartz.westnet.net.au...
Hi all,

I have an application that can use many different compact-flash cards as
storage for different jobs the client is working on. I have added a
function to erase all files from a flash card, and that works fine.

But I would also like to be able to make the Volume Label on each flash
card the job name its files belong to. I can't work out how to either
write the Volume Label to the cards, or to remove it when I erase them. I
did this in VB5 by using a Windows API call - surely VB.NET 2003 is
smarter than that?

Anybody know the "right" way to do this in VB.NET?

Thanks


Feb 27 '06 #3
Have you tried System.IO.DriveInfo.VolumeLabel?

http://msdn2.microsoft.com/en-us/lib...lumelabel.aspx

NOTE: Requires VS 2005.

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Steve Marshall" <st*****@westnet.net.au> wrote in message
news:11**************@quartz.westnet.net.au...
| Hi all,
|
| I have an application that can use many different compact-flash cards as
| storage for different jobs the client is working on. I have added a
| function to erase all files from a flash card, and that works fine.
|
| But I would also like to be able to make the Volume Label on each flash
card
| the job name its files belong to. I can't work out how to either write
the
| Volume Label to the cards, or to remove it when I erase them. I did this
| in VB5 by using a Windows API call - surely VB.NET 2003 is smarter than
| that?
|
| Anybody know the "right" way to do this in VB.NET?
|
| Thanks
|
|
Feb 28 '06 #4
CMM
Man, I wonder if anyone has gauged just how much of the Win32 API Microsoft
has managed to wrap in the framework? Seems to me that as of .NET 2.0,
they're nearning 100% (of the core API), no? That's a great accomplishment.

--
-C. Moya
www.cmoya.com
Feb 28 '06 #5
Here is the .NET 1.x to Win32 API map:

http://msdn.microsoft.com/library/de...l/win32map.asp

Not sure where or if there is a .NET 2.0 to Win32 API map.
Another good resource for .NET & Win32 APIs is http://www.pinvoke.net
--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"CMM" <cm*@nospam.com> wrote in message
news:u1**************@TK2MSFTNGP12.phx.gbl...
| Man, I wonder if anyone has gauged just how much of the Win32 API
Microsoft
| has managed to wrap in the framework? Seems to me that as of .NET 2.0,
| they're nearning 100% (of the core API), no? That's a great
accomplishment.
|
| --
| -C. Moya
| www.cmoya.com
|
|
Feb 28 '06 #6
CMM
The CLR and Framework team (teams? plural) are truly doing outstanding work.
I wish the IDE and Designer teams had the same vision and
attention-to-detail.

--
-C. Moya
www.cmoya.com
"Jay B. Harlow [MVP - Outlook]" <Ja************@tsbradley.net> wrote in
message news:eN**************@TK2MSFTNGP15.phx.gbl...
Here is the .NET 1.x to Win32 API map:

http://msdn.microsoft.com/library/de...l/win32map.asp

Not sure where or if there is a .NET 2.0 to Win32 API map.
Another good resource for .NET & Win32 APIs is http://www.pinvoke.net
--
Hope this helps
Jay [MVP - Outlook]
.NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"CMM" <cm*@nospam.com> wrote in message
news:u1**************@TK2MSFTNGP12.phx.gbl...
| Man, I wonder if anyone has gauged just how much of the Win32 API
Microsoft
| has managed to wrap in the framework? Seems to me that as of .NET 2.0,
| they're nearning 100% (of the core API), no? That's a great
accomplishment.
|
| --
| -C. Moya
| www.cmoya.com
|
|

Feb 28 '06 #7

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

Similar topics

4
by: Heiko Selber | last post by:
I am trying to find out (using Python under windows) the name of a CD that is currently in the drive specified by a path name. And while I am at it, I'd also like to know whether the specified...
138
by: theodp | last post by:
--> From http://www.techdirt.com/articles/20040406/1349225.shtml Microsoft Patents Saving The Name Of A Game Contributed by Mike on Tuesday, April 6th, 2004 @ 01:49PM from the...
1
by: Cliff Liao | last post by:
Hi all, I am trying to install the .NET framework 1.1 runtime package on Windows 2000 SP4. While the installation starts well, I get the following message box during the installation process :...
3
by: Bob Greschke | last post by:
....the name for a drive (hard or removable) that shows up when, for example, a USB flash drive is recognized by the system. I don't know if this shows up somewhere in Linux. Can this be set...
3
by: Jeff Gaines | last post by:
I am using the 'ManagementObject' to get the volume name of each drive on my PC. It works but it is a bottleneck. Is there an quicker way to get this information? I am using C# but am happy yo...
8
by: Dmitry Klymenko | last post by:
Do exists a way to detect a volume label of a disk? I've found the way to do this using WMI (System.Management) or winapi function. The second solution is principal non-portable in future, the first...
3
by: Just Me | last post by:
I check to see if the Floppy drive is ready and display it's state. But if the user inserts or removes a floppy disk I need an event or Windproof message to cause the code to display the new...
0
by: Allen | last post by:
Dim DiskMO As New ManagementObject("win32_logicaldisk.DeviceID=""" & sDrive & """") Then using DiskMO("DriveType") Case DRIVE_TYPES_REMOVABLE snip...
3
by: Mike Joyce | last post by:
I am trying to write a portable script that will find removable media, such as compact flash, sd card, usb, etc. drive and then upload files from the media. I want this to be portable so that I can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
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.