TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Herbert Bushong
from: Gary Chambers
date: 1996-09-06 13:19:08
subject: CD Changer eject/retract

Herbert Bushong to Darin McBride (Orig: 07:36, Tue, Sep 03, 1996):

 HB> ejected/loaded via software control under windows, I'm looking for
 HB> a  way to do it under os/2 (as I said before, a CD player program I
 HB> have is able  to eject it, but has not option to re-load, and only
 HB> works on the default  audio device.)

The topic has been covered in the past, so I'm reluctant to repost.  Since
I'm not familiar with your name, however, I will offer the solution to your
problem:

/******** Cut Here **********/

#define INCL_NOPMAPI
#define INCL_DOSDEVICES

#include 
#include 
#include 

VOID main(INT argc, PCHAR argv[])
{
    HFILE hCDHandle;
    ULONG ulAction;
    APIRET rc;
    CHAR chBuffer[4] = "CD01";

    if (argc < 2)
    {
        puts("\nSyntax: EJECT ");
        exit(EXIT_FAILURE);
    }

    rc = DosOpen(argv[1], &hCDHandle, &ulAction, 0L,
                 FILE_READONLY,
                 OPEN_ACTION_OPEN_IF_EXISTS,
                 OPEN_FLAGS_DASD | OPEN_SHARE_DENYREADWRITE,
                 0L);

    if (rc)
    {
        printf("SYS%04X: DosOpen\n", rc);
        exit(EXIT_FAILURE);
    }

    rc = DosDevIOCtl(hCDHandle, 0x0080, 0x0044,
                     &chBuffer, sizeof(chBuffer), 0L,
                     NULL, 0, NULL);

    if (rc)
    {
        printf("SYS%04X: DosDevIOCtl\n", rc);
        DosClose(hCDHandle);
        exit(EXIT_FAILURE);
    }
    DosClose(hCDHandle);
    exit(0);
}

/******** Cut here **********/

Hope this helps...

GeeCee/2
geecee{at}ime.net

... Topsham, ME 43 57.0'N 69 57.0'W 
--- 
* Origin: Mystic Seaport Inn OiS/2 - USR DS V.34+ - (207)721-3258 (1:326/426)
SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 624 628 713/888 800/1
@PATH: 326/426 400 3615/50 396/1 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.