Need help on CD-Rom door using DoEvents??? 
Author Message
 Need help on CD-Rom door using DoEvents???

Hi,
I could really use some help on this.
I'm trying to open/close the CD-ROM door
from within VB.  So far my program can
open the door, (Command1), and immediately
close the door, (Command2). After the door
is closed, the system trys to read the CD
Header or someting. This takes about 15 secs.
I've placed a Timer and a Textbox to count
down from 15 to 0 the amount af secs it takes
to do this.
Problem is that after closing the door,
everything stops while the CD is being read.

How can I keep the timer running and
displaying the count down time in the Textbox
while the CD is being read??

I've tried DoEvents all over the place but,
so far everything stops during this read.

  Thanks,
                        Magic

***** Th following is my Code

Option Explicit

Private Sub Command1_Click()

    CDDoorOpen "True"

End Sub

Private Sub Command2_Click()

    Text1.Text = 15
    Text1.Visible = True
    CDDoorOpen "False"

End Sub

Private Sub Form_Load()

    Text1.Visible = False

End Sub

Private Sub Timer1_Timer()

    Text1.Text = Text1.Text - 1
    If Text1.Text = 0 Then
       Text1.Text = 15
    End If

End Sub

***** The following is my Modual.bas

Option Explicit

Declare Function mciSendString Lib "winmm.dll" Alias _
      "mciSendStringA" (ByVal lpstrCommand As String, ByVal _
      lpstrReturnString As String, ByVal uReturnLength As Long, _
      ByVal hwndCallback As Long) As Long

 Sub CDDoorOpen(YesNo As Boolean)

      Dim returnstring As String
      Dim retvalue As String
      Dim SW As String
 '==================================================

      If YesNo Then
      'To open the CD door, use this code
          retvalue = mciSendString("Set CDAudio door open", "", 0, 0)
          'retvalue = mciSendString("set CDAudio door open", _
          '           returnstring, 127, 0)

            Else

      'To close the CD door, use this code
          retvalue = mciSendString("Set CDAudio door closed", "", 0, 0)
          'retvalue = mciSendString("set CDAudio door closed", _
          '           returnstring, 127, 0)

      End If

 End Sub



Wed, 10 Jan 2001 03:00:00 GMT  
 Need help on CD-Rom door using DoEvents???
this may not work, but you can also try the Refresh method for the label or
textbox your counting down in
Quote:

>Hi,
>I could really use some help on this.
>I'm trying to open/close the CD-ROM door
>from within VB.  So far my program can
>open the door, (Command1), and immediately
>close the door, (Command2). After the door
>is closed, the system trys to read the CD
>Header or someting. This takes about 15 secs.
>I've placed a Timer and a Textbox to count
>down from 15 to 0 the amount af secs it takes
>to do this.
>Problem is that after closing the door,
>everything stops while the CD is being read.

>How can I keep the timer running and
>displaying the count down time in the Textbox
>while the CD is being read??

>I've tried DoEvents all over the place but,
>so far everything stops during this read.

>  Thanks,
>                        Magic

>***** Th following is my Code

>Option Explicit

>Private Sub Command1_Click()

>    CDDoorOpen "True"

>End Sub

>Private Sub Command2_Click()

>    Text1.Text = 15
>    Text1.Visible = True
>    CDDoorOpen "False"

>End Sub

>Private Sub Form_Load()

>    Text1.Visible = False

>End Sub

>Private Sub Timer1_Timer()

>    Text1.Text = Text1.Text - 1
>    If Text1.Text = 0 Then
>       Text1.Text = 15
>    End If

>End Sub

>***** The following is my Modual.bas

>Option Explicit

>Declare Function mciSendString Lib "winmm.dll" Alias _
>      "mciSendStringA" (ByVal lpstrCommand As String, ByVal _
>      lpstrReturnString As String, ByVal uReturnLength As Long, _
>      ByVal hwndCallback As Long) As Long

> Sub CDDoorOpen(YesNo As Boolean)

>      Dim returnstring As String
>      Dim retvalue As String
>      Dim SW As String
> '==================================================

>      If YesNo Then
>      'To open the CD door, use this code
>          retvalue = mciSendString("Set CDAudio door open", "", 0, 0)
>          'retvalue = mciSendString("set CDAudio door open", _
>          '           returnstring, 127, 0)

>            Else

>      'To close the CD door, use this code
>          retvalue = mciSendString("Set CDAudio door closed", "", 0, 0)
>          'retvalue = mciSendString("set CDAudio door closed", _
>          '           returnstring, 127, 0)

>      End If

> End Sub



Wed, 10 Jan 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Open CD Rom Door Crashes app

2. How to Lock CD-Rom door

3. How lo lock CD ROM door ?

4. Open/Close CD-ROM Door Problem??

5. How do I open/close the CD Rom Drive Door

6. How to open Cd-rom Door

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

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

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

10. need help: MSCDEX CD-ROM programming in QB 4.5

11. need help: MSCDEX CD-ROM programming

12. Need help recognizing a CD Rom in VB4

 

 
Powered by phpBB® Forum Software