Solved

Lock a cdrom, How?

Posted on 1997-07-25
3
266 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
  • 2
3 Comments
 

Accepted Solution

by:
overworked earned 50 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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 video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now