.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Windows Form Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Open And Close CD\DVD Drive Tray using VB.Net

Posted By:Hefin Dsouza       Posted Date: April 27, 2009    Points: 10    Category: Windows Form Controls    URL: http://www.dotnetspark.com  
 

The Following code demonstrates a API to Open a CD Drive Tray and Close it from an VB.NET Application
The API Declaration is as Follows


Declare Function s Lib "winmm.dll" Alias "mciSendStringA" (ByVal ab As String, ByVal ass As String, ByVal s As Integer, ByVal aas As Integer) As Integer


To Open the CD Tray use


    Public Function Open() As Integer

        Dim ret As String

        ret = New String(CChar(" "), 255)

        Open = s("Set CDAudio Door Open Wait", ret, 0&, 0&)

    End Function


To Close the CD Tray use


Public Function Closes() As Integer

  Dim varStr As String

  varStr = New String(CChar(" "), 255)

  Closes = s("Set CDAudio Door Closed Wait", strReturn, 0&, 0&)

    End Function


Regards Hefin Dsouza
[Faculty & Coporate Trainner]


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend