Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CD-Rom Opening

Posted on 1999-07-01
10
Medium Priority
?
203 Views
Last Modified: 2010-05-02
Does anyone know the API function used to open your cd-rom drive, i will be grateful for this
0
Comment
Question by:DefTones
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1521415
To open the CD-ROM:

call mciSendString("Set cdaudio door open wait", vbNull, 0, handle)



To close the CD-ROM:

call mciSendString("Set cdaudio door closed wait", vbNull, 0, handle)

mciSendString() is declared in MMSystem

..-=ViKtOr=-..
0
 
LVL 2

Expert Comment

by:BeedleGuis
ID: 1521416
do you have the syntax for the declare?
0
 

Expert Comment

by:gshriki
ID: 1521417
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

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Accepted Solution

by:
Smout earned 210 total points
ID: 1521418

                  
'***************************************************************
'Windows API/Global Declarations for :Close/open the CD Rom door
'***************************************************************


Declare Function mcisendstring Lib "MMSystem" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal wReturnLength As Integer, ByVal hCallback As Integer) As Long
 

'to close it:

retvalue = mcisendstring("set CDAudio door closed", returnstring, 127, 0)
'to open it

retvalue = mcisendstring("set CDAudio door open", returnstring, 127, 0)

For NT the declaration should be:Private 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 LongThis is because the mmsystem.dll is not
32-bit. It can be used, but not easily.

or use

Declarations: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 LongCode:
Open:x= mciSendString("set cd door open", 0&, 0, 0)Close:
x = mciSendString("set cd door closed", 0&, 0, 0)
0
 
LVL 2

Expert Comment

by:s_lavie
ID: 1521419
I think you shouldn't reject viktornet answer, but ask for more explenation...
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1521420
I really think that you should reject SMout's answer and let me answer, because my answer was correct... YOu shouldn't have rejected at the first place, and simply ask for more details... i would've given you the declare...

..-=ViKtOr=-..
0
 
LVL 1

Author Comment

by:DefTones
ID: 1521421
Umm i found out one thing viktor, its not declared in MMsystem, its declared in winmm

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1521422
MMSystem, is the name for it.. somethin like an Alias or a nickname.. at least i know it under that name.... the DLL NAME is different though... anyway, I would've given you the declaration... DefTones, I can't believe that you were actually looking at what i've said just to cut me off with my answer?! unbelievable....

-vik-
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1521423
okay, fine... you didn't accept my answer because of something you thought was not the right answer... why did you give Smout a "B" mark, when he gave you the fully working solution??

-vik-
0
 
LVL 1

Author Comment

by:DefTones
ID: 1521424
People, its points..ok, its not a life-or-death situation
youll probably make twice as many points on another ? you answer

And, i had to look at your answer to see whether it worked or not, thats the whole idea of Ex-Exchange

Deftones
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question