msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Reading name assigned to CD/DVD when it was burned

 
Post new topic   Reply to topic    msvisual.com Forum Index -> VB Syntax
Author Message
Lamont



Joined: 04 Oct 2007
Posts: 21

PostPosted: Sun Aug 19, 2007 1:16 am    Post subject: Reading name assigned to CD/DVD when it was burned Reply with quote

I am trying to write code to write a record to an Access database on my hard
drive for each file that has been backed up to a CD or DVD.

Each record should contain the following:
Name of file
Path to the file on the DVD or CD
Size of the file
Date of the file
Name of the media which I assigned when the media was burned,
e.g. "DiskNbr0294"

The name of the media is what is displayed in the left pane of Windows
Explorer for the content of the "My Computer" folder

The methods "CreateObject", "GetDrive", and "GetDriveName" would seem to be
what is needed to get the name of the media. So, I tried the following:

Project references assigned are:
Visual Basic for Applications
Visual Basic runtime objects and Procedures
Visual Basic objects and procedures
Ole Automation
Mcirosoft ActiveX Data Objects Recordset 2.8 Library
Microsoft ActiveX Dat Objects 2.8 Library
Microsoft Scripting Runtime
Microsoft Script Control 1.0
Microsoft Scriptlet Library
Microsoft WMI Scripting V1.2 Library


Dim oFileSystemObject As Object
Dim oDrive As Object
Dim oDriveName As Object
Dim sDriveName As String
Set oFileSystemObject = CreateObject("scripting.filesystemobject")
Set oDrive = oFileSystemObject.getdrive("d:") 'Should return drive object
for path d:
'Help syntax above is object.GetDrive drivespec
'Where object is a file system object
sDriveName = oDrive.getdrivename("d:")
sDriveName = oFileSystemObject.getdrivename("d:")
'Help syntax above is object.GetDriveName(path)
'where object is FileSystemObject

oDrive displays "D:" when the mouse cursor is put on it.
The first assign of sDriveName fails with "Object Doesn't Support this
property or method."
The second assign of sDriveName simply sets it = "d:"

So, the name which I assigned to the CD/DVD media volume seems to be some
other attribute than what I can find in the VB reference.

Thank you for kind help.
--
Lamont Phemister

Archived from group: microsoft>public>vb>syntax
Back to top
View user's profile Send private message
Larry Serflaten



Joined: 04 Oct 2007
Posts: 2644

PostPosted: Sun Aug 19, 2007 6:57 am    Post subject: Re: Reading name assigned to CD/DVD when it was burned Reply with quote

"Lamont" wrote

Please do not post copies of your questions to several groups.
(Do not multipost)

If more than one group is appropreate, include them all on the
Newsgroups: (or To:) line separated by commas.
(Do crosspost)

Your question has been answered in another group. Had you
crossposted your question, that reply would have been seen
here as well and people inclined to respond wold know if the
question has already been answered or not.

LFS
Back to top
View user's profile Send private message
Lamont



Joined: 04 Oct 2007
Posts: 21

PostPosted: Mon Aug 20, 2007 3:10 am    Post subject: Re: Reading name assigned to CD/DVD when it was burned Reply with quote

Hello Larry, I am glad to learn about cross post. Thank you for the tip and
for many assists. You are one of the most devoted mentors on MSDN. You
have my vote for patron saint of struggling coders.
--
Lamont Phemister


"Larry Serflaten" wrote:

>
> "Lamont" wrote
>
> Please do not post copies of your questions to several groups.
> (Do not multipost)
>
> If more than one group is appropreate, include them all on the
> Newsgroups: (or To:) line separated by commas.
> (Do crosspost)
>
> Your question has been answered in another group. Had you
> crossposted your question, that reply would have been seen
> here as well and people inclined to respond wold know if the
> question has already been answered or not.
>
> LFS
>
>
>

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    msvisual.com Forum Index -> VB Syntax All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group