.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 >> Forum >> VB.Net >> Post New QuestionBookmark and Share Subscribe to Forum

How to Eject CD Using VB.Net Application?

Posted By: Sushil     Posted Date: January 26, 2010    Points:2   Category :VB.Net
I want simple code to Open and Close the Writer using Visual Basic.Net 2008 Code

Responses
Author: Lalij Mer             
Posted Date: January 27, 2010     Points: 5   

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


Please Check my answer if you help....
Thank You...

Lalit.
Author: Lalij Mer             
Posted Date: January 27, 2010     Points: 5   

you can use this code sample

Module Module1

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


Sub Main(ByVal args() As String)


Dim result As Integer
result = mciSendString("Set CDAudio Door Open", _
Nothing, 0, 0)
Console.WriteLine("mciSendString returned " _
& result)

End Sub

End Module


reference
---------------
http://loytty.spaces.live.com/blog/cns!D38B786E8EA7A572!13208.entry

Please Check my answer if you help....
Thank You...

Lalit.
Author: Sagar Pardeshi             
Posted Date: February 01, 2010     Points: 5   

use this link

http://www.dreamincode.net/code/snippet469.htm



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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