Solved

Lock a cdrom, How?

Posted on 1997-07-25
3
269 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
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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem updating Access table using VB code 8 51
Query performance - SQL Server 20 82
Windows Installer 4 72
Access 2013: API code to put hidden database icon in taskbar? 8 74
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.…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
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…

770 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