Eject cd code

T

tkole

Guest
#1
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?
 
#2
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 posts

Latest profile posts

Perris Calderon wrote on Electronic Punk's profile.
Ep, glad to see you come back and tidy up...did want to ask a one day favor, I want to enhance my resume , was hoping you could make me administrator for a day, if so, take me right off since I won't be here to do anything, and don't know the slightest about the board, but it would be nice putting "served administrator osnn", if can do, THANKS

Been running around Quora lately, luv it there https://tinyurl.com/ycpxl
Electronic Punk wrote on Perris Calderon's profile.
All good still mate?
Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,970
Messages
673,297
Members
89,016
Latest member
Poseeut