Re: preventing crash of cd based program when cd-rom ejected

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Hapticz (hapticz_at_email.msn.com)
Date: 09/01/04


Date: Wed, 1 Sep 2004 07:00:15 -0400

perhaps disable the cdrom "eject" button while the prog is running? (via scsi/esdi interface api "prevent eject command" or "lock
drive command")

then re-enable eject when user intentionally stops the main program

this will force use of cdroms to only a single ongoing program at a time. (ie no distractions?)

but if you use the cdrom eject button as a program control method, you lessen sight impaired users need for video interaction
(good?) & then it may be better to use the suggestions of the other discussion group replies

Best regards,
Hapticz

STOP STOP STOP STOP STOP STOP STOP STOP STOP
<>><<>><<><>><<><>><<>><<><>><<>><<>><<>><<>><<>

"Matthew Nuzum" <matt@REMOVE.CAPS.followers.net.NOSPAM> wrote in message news:48802003-373B-4590-86E6-CEB9CFACECA1@microsoft.com...
> I'm part of a small team that has been developing a VB 6 program for use by
> blind and visually impaired users. It runs entirely from 2 CD-ROMs without
> any data being copied to or installed onto the hard drive.
>
> Each CD-ROM is autonomous from the other. More specifically, the first
> CD-ROM reads the text of the Old Testament of the Bible, the second CD-ROM
> reads the text of the New Testament of the Bible.
>
> Everything works well except for one particular thing. Our first round of
> testing revealed a problem where if someone ejected and re-inserted the same
> cd-rom the program would open and play a second copy. You could do this
> repeatedly and have several audio messages playing simultaneously.
>
> Additionally, you can eject and insert the other disk and hear both copies
> play for a short time. Then, the first program would become unresponsive.
>
> To solve this we found reference to some code (from vb 4) and modified it to
> work in our environment (VB 6 sp6). It looks like this:
> Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
> lpClassName As String, ByVal lpWindowName As String) As Long
> Private Declare Function PostMessage Lib "user32" Alias "PostMessageA"
> (ByVal hwnd As Long, ByVal wMsg As Integer, ByVal wParam As Integer, lParam
> As Any) As Long
> Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA"
> (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
> Private Declare Function GetWindowTextLength Lib "user32" Alias
> "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
>
> ...
> Dim iHwnd As Long, iReturn As Long, iSpace As Long
> iHwnd = FindWindow(sClass, sTitle)
> iSpace = GetWindowTextLength(iHwnd)
> sCompare = Space(iSpace)
> GetWindowText iHwnd, sCompare, iSpace + 1
> If sCompare = sTitle Then
> iReturn = PostMessage(iHwnd, WM_QUIT, 0, 0&)
> End If
>
> I know that may be hard to follow, please let me know if more clarification
> is needed.
>
> This works when we run the program from our network which simulates a CD-ROM
> drive during development. During this round of testing we've been dismayed
> to find the problem is now worse. If you eject and re-insert the disk the
> program freezes after a moment and the only thing that will close the program
> is a reboot.
>
> Because of the code above you cannot start a new instance of the program
> because the old program is still running (frozen).
>
> Really, the solution I think is to detect if the cd-rom is ejected.
>
> Because of my target users, the worst thing I can do is to pop-up a message
> box or produce an error that needs to be read or clicked. I need to handle
> all errors and either recover or die gracefully.
>
> Any suggestions?
> --
> Matthew Nuzum
> Followers.net, Inc.



Relevant Pages

  • Network Installation - CD-ROM not auto ejecting
    ... I'm upgrading from RHAS 3 to RHAS ... I'm using a cd-rom to boot from which contains a ks.cfg file. ... The server automatically reboots after the upgrade has completed. ... The problem is that it does not automatically eject the cd-rom before it ...
    (Fedora)
  • Re: Cannot eject CD-ROM
    ... Straighten a paper clip, ... bngh hunted and pecked: ... if I leave my Microsoft Streets and Trips CD-ROM in the CD drive ... > overnight), when I try to eject the CD-ROM, the CD tray will not open. ...
    (microsoft.public.windowsxp.hardware)
  • Need help with Weird CD-ROM problems
    ... I need help with Weird CD-ROM problems. ... eject through Windows Explorer by right-clicking the drive and selecting ... the Disk Management MMC by right-clicking the CD-ROM and clicking eject. ... CD-ROM drives are numbered strangely in Disk Management - I have two ...
    (microsoft.public.windowsxp.setup_deployment)
  • Need help with weird CD-ROM problem
    ... I need help with Weird CD-ROM problems. ... eject through Windows Explorer by right-clicking the drive and selecting ... the Disk Management MMC by right-clicking the CD-ROM and clicking eject. ... CD-ROM drives are numbered strangely in Disk Management - I have two ...
    (microsoft.public.windowsxp.general)
  • Need help with weird CD-ROM problems
    ... I need help with Weird CD-ROM problems. ... eject through Windows Explorer by right-clicking the drive and selecting ... the Disk Management MMC by right-clicking the CD-ROM and clicking eject. ... CD-ROM drives are numbered strangely in Disk Management - I have two ...
    (microsoft.public.windowsxp.help_and_support)