|
-
Jun 2nd, 2006, 06:02 AM
#1
Thread Starter
Member
[2005] CD/DVD Eject using WMI
well, I am looking for the code to eject CD using WMI class. May be System.Management can do this but as I am extremely new to .NET I need ur help.
I have used mciSendMessage but it's giving me the error. However, I prefer to use System.Management namespace if it can possible thurgh it..
I am Using .NET 2005 ..
bye
-
Jun 2nd, 2006, 06:06 AM
#2
Re: [2005] CD/DVD Eject using WMI
I use this when I want to eject the disc tray:
VB Code:
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" _
(ByVal lpstrCommand As String, _
ByVal lpstrReturnString As String, _
ByVal uReturnLength As Int32, _
ByVal hwndCallback As Int32) As Int32
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
mciSendString("set CDAudio door open", Nothing, 127, 0)
End Sub
not wmi but hey it works
-
Jun 2nd, 2006, 06:27 AM
#3
Thread Starter
Member
Re: [2005] CD/DVD Eject using WMI
Well It's working fine compare to my previous code..
VB Code:
mciSendString("set CDAudio door open", 0, 0, 0)
btw, can u plz add comment so that i can understand the function..
Moreover, I have also found one link which seems to use WMI but i can't understand the code..
http://www.mredkj.com/netconversions/cdevents.html
If some one can explain it to me than it would be great..
-
Jun 2nd, 2006, 09:01 AM
#4
Hyperactive Member
Re: [2005] CD/DVD Eject using WMI
The link is to detect when the tray has been ejected or loaded (propbably by detecting when media arrives.)
gigemboy shows how to eject a specific drive with mciSendString here:
http://www.vbforums.com/showthread.p...ighlight=eject
here's load/unload/lock/unlock by various methods:
http://www.vbforums.com/showthread.php?t=357496
Use MciSendstring, there is no method to eject using WMI.
Look up MCI in the msdn library...
-
Jun 2nd, 2006, 10:21 PM
#5
Hyperactive Member
Re: [2005] CD/DVD Eject using WMI
GREAT dude. I am just looking for this ..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|