Eject cd code

T

tkole

Guest
I have been trying to find a way to eject my cdrom with a single executable file and found this from Kruger in a search:

Script below:

****
Option Explicit

Public 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


Private Sub Command1_Click()

Call mciSendString("Set CDAudio Door Open Wait", 0&, 0&, 0&)

End Sub
'--end block--'

****

I am totally new to prgramming and wonder how I might use this info to create a single executable file?
 
It looks like VB code anyway. I suggest you paste it into a new Visual Basic project. I think you might want to change it a bit:

Code:
Option Explicit 

Public 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 

Sub Main() 
    Call mciSendString("Set CDAudio Door Open Wait", 0&, 0&, 0&) 
End Sub
I think that's the syntax, but I'm not sure. I haven't programmed in VB for years.
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back