Solved

Lock a cdrom, How?

Posted on 1997-07-25
3
279 Views
Last Modified: 2013-12-03
I use VC++4.2 on Win95, how can I lock the cdrom so the user
can't open the tray by pressing the eject button on the cdrom panel? I know it can be done by software but don't know how. Is there an API call for this or I need to go low level(programming interrupt thing)?
Any help is appreciated
0
Comment
Question by:danli020797
[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
  • 2
3 Comments
 

Accepted Solution

by:
overworked earned 50 total points
ID: 1401980
I can't remember if the command is available through Windows API but if it isn't there, there is a good reason. First of all, it will serve no purpose to you since locking the tray does not defeat the hardware cd eject button. The hardware cd eject button will unlock the tray before opening. However, locking the tray will defeat software attempts to eject until the tray is unlocked first. The tray lock/unlock functions are available via MSCDEX function calls as far as I know.
0
 

Author Comment

by:danli020797
ID: 1401981
The reason I want to lock the cdrom is that I am writing an app. to play video from cdrom. I can't open the tray after I open the device, otherwise I will get the Blue Screen even though the cd is not playing. So I need the user to eject from my app so I can close the device first. I saw another app did exact the same thing.
Could you tell me how MSCDEX works, through switches?
Thanks
0
 

Expert Comment

by:overworked
ID: 1401982
There's an MSCDEX techref kit floating around that's distributed by Microsoft. Try searching the net and MS web site. However, I would recommend polling MCI cdrom (MCI_STATUS) every half second to see if cdrom was ejected by user and handle that way. The best way to do this is to get MCI_STATUS in your WM_TIMER and save it, compare it with the last saved, and if different see what the condition is (see if media ejected).
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

628 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