Cd rom 
Author Message
 Cd rom

Can anyone help me to make a code to open the cd tray after clicking a button


Tue, 18 Feb 2003 10:27:55 GMT  
 Cd rom

That same question was asked and answered in the last 2 or 3 days in the
...scripting.VBScript NG

<post author="Bill James">

I got this from a newsgroup post, but neglected to record who gets the
credit for it.  If I were to guess, I would say Walter Zachary.

<note>It was Walter...</note>

Option Explicit
Dim Shell
Dim System
Dim Count
Dim Drive
Set System = CreateObject("Scripting.FileSystemObject")
For Count = Asc("d") To Asc("z")
   If System.DriveExists(Chr(Count)) Then
      Set Drive = System.GetDrive(Chr(Count))
      If Drive.DriveType = 4 Then
         On Error Resume Next
         Set Shell = CreateObject("Shell.Application").NameSpace(17)
         Shell.ParseName(Drive & "\").InvokeVerb("e&ject")
         Exit For
      End If
   End If
Next 'Count
Set Shell = Nothing
Set System = Nothing

</post>

--
Michael Harris
Microsoft.MVP.Scripting
--


Quote:
> Can anyone help me to make a code to open the cd tray after clicking a

button


Tue, 18 Feb 2003 11:17:52 GMT  
 Cd rom
This is great, but how does one close the cd drive? and how does 1 tell if
it is open or shut?

thanks arron

Quote:

> That same question was asked and answered in the last 2 or 3 days in the
> ...scripting.vbscript NG

> <post author="Bill James">

> I got this from a newsgroup post, but neglected to record who gets the
> credit for it.  If I were to guess, I would say Walter Zachary.

> <note>It was Walter...</note>

> Option Explicit
> Dim Shell
> Dim System
> Dim Count
> Dim Drive
> Set System = CreateObject("Scripting.FileSystemObject")
> For Count = Asc("d") To Asc("z")
>    If System.DriveExists(Chr(Count)) Then
>       Set Drive = System.GetDrive(Chr(Count))
>       If Drive.DriveType = 4 Then
>          On Error Resume Next
>          Set Shell = CreateObject("Shell.Application").NameSpace(17)
>          Shell.ParseName(Drive & "\").InvokeVerb("e&ject")
>          Exit For
>       End If
>    End If
> Next 'Count
> Set Shell = Nothing
> Set System = Nothing

> </post>

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --



> > Can anyone help me to make a code to open the cd tray after clicking a
> button



Wed, 19 Feb 2003 10:32:39 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Accessing file from one CD-ROM in a multiple CD-ROM system

2. How to change Multi Media CD-ROM in two or more CD-ROM system

3. help w/ cd-rom and cd-r/cd-rw program, please

4. check is there a CD ROM in the CD drive

5. cd player writing on cd-rom??????

6. Cluster size of a CD-ROM and a control to burn a CD

7. Use 2nd CD-ROM drive to play CD Audio

8. Can a Java Applet, run from a CD-ROM, access other files on the CD-ROM?

9. Using Acrobat Reader on Presentation CD-ROM

10. Newby: Determine CD-ROM drive letter

11. opening CD-ROM tray

12. CD-ROM version of ASP Pages

 

 
Powered by phpBB® Forum Software