Ask Experts Questions for FREE Help!
Answer   ||    Advanced Search

Ask your question or search...
International Sites: Nederlandse experts vragen
User Name 
Password 
Join   Forgot password? 

Home > Computers & Technology > Programming > Compiled Languages > Visual Basic   »   vb.net code to eject cd from drive

Question
 
 
#1  
Old Oct 7, 2009, 11:35 PM
zerihun_m
New Member
zerihun_m is offline
 
Join Date: Oct 2009
Posts: 4
zerihun_m See this member's comment history on his/her Profile page.
vb.net code to eject cd from drive

sir

how to open or close cd drive using vb.net code .

Reply With Quote
 
     

Answers
 
 
Old Oct 8, 2009, 06:05 AM   #2  
Ultra Member
Perito is offline
 
Perito's Avatar
 
Join Date: Feb 2009
Location: USA
Posts: 2,886
Perito See this member's comment history on his/her Profile page.Perito See this member's comment history on his/her Profile page.
Opening and closing the CD tray in .NET (C# Programming Tutorial) • Geekpedia

Private 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

Basically, you declare a function from WinMM.dll (Windows Multi-media library), as shown above, and call it. This will then open the door (if you have only one CD):

mciSendString "Set CDAudio Door Open Wait", 0&, 0&, 0&

This will close the door:

mciSendString "Set CDAudio Door Closed Wait", 0&, 0&, 0&

The article, above, shows how to open a drive if multiple drives are in the system. The code in the article is in C#, but the strings in the "mciSendString" calls are what you need and they don't vary from language to language.
  Reply With Quote
 
     

Your Answer
Email me when someone replies to my answer
Join Login



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Ask your question or search...



Similar Threads
Ice Maker on Whirlpool Refrigerator will not eject Ice
(3 replies)
DVD and CD woun't eject
(1 replies)
After EJECT how to reconnect the USB drive without Manual intervention?
(3 replies)
CD/DVD won't eject
(2 replies)
Ice maker won't eject
(1 replies)

Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page
Search this Thread

Advanced Search

Bookmarks





Copyright ©2003 - 2009, Ask Me Help Desk.
All times are GMT -8. The time now is 04:54 PM.