|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
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 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. Show quoteHide quote "Steve Marshall" <stev***@westnet.net.au> wrote in message news:1141030193.74219@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 > 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. Show quoteHide quote "CMM" <cmm@nospam.com> wrote in message news:%235ny3Q4OGHA.3728@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" <stev***@westnet.net.au> wrote in message > news:1141030193.74219@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 >> > > Have you tried System.IO.DriveInfo.VolumeLabel?
http://msdn2.microsoft.com/en-us/library/system.io.driveinfo.volumelabel.aspx NOTE: Requires VS 2005. -- Show quoteHide quoteHope this helps Jay [MVP - Outlook] ..NET Application Architect, Enthusiast, & Evangelist T.S. Bradley - http://www.tsbradley.net "Steve Marshall" <stev***@westnet.net.au> wrote in message news:1141030193.74219@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 | | 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. Here is the .NET 1.x to Win32 API map:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/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 -- Show quoteHide quoteHope this helps Jay [MVP - Outlook] ..NET Application Architect, Enthusiast, & Evangelist T.S. Bradley - http://www.tsbradley.net "CMM" <cmm@nospam.com> wrote in message news:u1$ofMAPGHA.1040@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 | | 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. Show quoteHide quote "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_***@tsbradley.net> wrote in message news:eNk0TQBPGHA.2236@TK2MSFTNGP15.phx.gbl... > Here is the .NET 1.x to Win32 API map: > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/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" <cmm@nospam.com> wrote in message > news:u1$ofMAPGHA.1040@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 > | > | > >
Did we lose the RadioCheck property on menuitems
Webapplications quits without matter in ASP.NET 2.0 DateTimePicker + DataBinding + Null-Value: THE solution? Is there a simple way to email? What is Instrumentation? Help please Creating web page of links and content Ado.net to excel ? Listbox controls Perfomance test NEWBIE question |
|||||||||||||||||||||||