473,656 Members | 2,824 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2671
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*****@westne t.net.au> wrote in message
news:11******** ******@quartz.w estnet.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******** ********@tk2msf tngp13.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*****@westne t.net.au> wrote in message
news:11******** ******@quartz.w estnet.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.Drive Info.VolumeLabe l?

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*****@westne t.net.au> wrote in message
news:11******** ******@quartz.w estnet.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******** ******@TK2MSFTN GP12.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******** ******@TK2MSFTN GP15.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******** ******@TK2MSFTN GP12.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
2894
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 drive contains a CD at all, and whether the drive is actually a CD drive. AFAIK, Python doesn't provide a way to do it, and a search in the web yielded only soutions for Linux. Can anyone show me a solution that works with windoze?
138
6511
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 yeah,-that's-non-obvious dept. theodp writes "As if there weren't enough dodgy patents, here's an excerpt from one granted to Microsoft Tuesday for a 'Method and apparatus for displaying information regarding stored data in a gaming system': 'When saving a game,...
1
451
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 : Please insert the disk : Microsoft .NET Framework (English) : OK Cancel Pressing the OK button will check the floppy drive for a disk and
3
4932
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 from Python? I guess it would be some MFC call in Windows (I don't know anything about doing that), and some ??? call in Linux? Could use both. Thanks!
3
3324
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 make API calls. I have tried the API call 'GetVolumeInformation' which returns the drive letter rather than the volume name and also another function (name forgotten) which returned a string that looked like it might be the volume 'unique'...
8
3256
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 one require service WMI to work on client (for sure it's not a guarantee to be allways running). I do not want to include in my application logic, that will attempt to start that service before determining logical drive volume label. If no way to...
3
2113
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 state. Is the some way the code can be alerted to the fact that a removable disk drive's state changed?
0
1053
by: Allen | last post by:
Dim DiskMO As New ManagementObject("win32_logicaldisk.DeviceID=""" & sDrive & """") Then using DiskMO("DriveType") Case DRIVE_TYPES_REMOVABLE snip...
3
3890
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 write and maintain one program for both Linux and Windows. Each platform uses different functions so even if I could find two platform dependent functions that would be fine. Basically, I would like to avoid checking fixed disks if possible. If...
0
8382
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8816
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8498
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
7311
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5629
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1930
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1600
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.