Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Visual Basic (https://www.askmehelpdesk.com/forumdisplay.php?f=469)
-   -   Vb.net code to eject cd from drive (https://www.askmehelpdesk.com/showthread.php?t=403786)

  • Oct 7, 2009, 11:35 PM
    zerihun_m
    Vb.net code to eject cd from drive
    Sir

    How to open or close cd drive using vb.net code .
  • Oct 8, 2009, 06:05 AM
    Perito
    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.
  • Jan 7, 2011, 10:32 PM
    jeya_raman09
    videocoferencing code for ASP.net with c#

  • All times are GMT -7. The time now is 04:06 AM.