Welcome to our forums...

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Forum Statistics

  • Forum Members:
  • Total Threads:
  • Total Posts: 3
There are 1 users currently browsing forums.
Visual Basic Programming This area is for talking about programming with visual basic.

Reply
  #1  
Old 03-12-2005
born2c0de's Avatar
pf("I'm a %XR",195926478)
 
Join Date: Jan 2005
Location: Mumbai, India
Age: 21
Posts: 320
Rep Power: 7
born2c0de is on a distinguished roadborn2c0de is on a distinguished road
Question What about Multiple CD-Drives?

I know how to open and close a CD-ROM Drive. I've posted the code here.
Code:
Option Base 1
Public 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 main()
'           CD Open/Close  Program
'                                  -Sanchit Karve
'               You are allowed to distribute this code without making
'               changes to it.
'                                       -Sanchit Karve
'                                           born2c0de@hotmail.com
 
Dim Now As String
  Dim a(2) As String
  a(1) = "set cdaudio door open"
  a(2) = "set cdaudio door closed"
  total = 1     'Set this to the number of cycles you want it to undergo
   For i = 1 To (total * 2)
  If Int(i / 2) = i / 2 Then
  Now = vbString(a(2), 0)
  Else
  Now = vbString(a(1), 0)
  End If
  Next i
 
End Sub
Function vbString(ByVal Command As String, ByVal hWnd As Long) As String
    Dim Buff As String
    Dim dwR As Long
    Buff = Space$(100) ' Create a buffer
    dwR = mciSendString(Command, ByVal Buff, Len(Buff), hWnd)
    vbString = Buff
End Function

But what if someone has more than 1 CD Drives...how can we open each drive then?
Reply With Quote
  #2  
Old 03-14-2005
koko775's Avatar
Accomplished Graduate Student
 
Join Date: Sep 2004
Posts: 350
Rep Power: 6
koko775 is on a distinguished road
Re: What about Multiple CD-Drives?

for one thing, you'd have to be more specific than cdaudio.
Reply With Quote
  #3  
Old 03-14-2005
born2c0de's Avatar
pf("I'm a %XR",195926478)
 
Join Date: Jan 2005
Location: Mumbai, India
Age: 21
Posts: 320
Rep Power: 7
born2c0de is on a distinguished roadborn2c0de is on a distinguished road
Re: What about Multiple CD-Drives?

well..ok...like what?
Reply With Quote


Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing binary to allow a program to open multiple times at a time roger04 C and C++ Programming 4 03-14-2005 08:43 AM
displaying latest entries from multiple tables HombreRana PHP Scripting 14 01-18-2005 07:36 PM