Re: MCI Devices in Console Apps
From: Kralizec (anonymous_at_discussions.microsoft.com)
Date: 03/19/04
- Previous message: Mehul Sachdev: ".wav file recording"
- In reply to: William DePalo [MVP VC++]: "Re: MCI Devices in Console Apps"
- Next in thread: William DePalo [MVP VC++]: "Re: MCI Devices in Console Apps"
- Reply: William DePalo [MVP VC++]: "Re: MCI Devices in Console Apps"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 18 Mar 2004 16:01:06 -0800
Thanks for all the help. It will be very useful. By the way, I also found you can leave out the MCI_NOTIFY and MCI_WAIT altogether and use MCI_STATUS to poll the device. I do have one more question for you, though.
If it's possible to create Windows in a console applications (using main instead of WinMain) then why, in MS VC++, when I'm working on a console app, don't the function reference tips pop up for functions such as RegisterClass and CreateWindow. But when I'm writing a Windows app, using WinMain, they do pop up?
----- William DePalo [MVP VC++] wrote: -----
"Kralizec" <anonymous@discussions.microsoft.com> wrote in message
news:57B57191-BF2C-4E75-96FD-13D128BF1769@microsoft.com...
> I'd like to create a console application that uses audio CDs.
> This is a bit more difficult than it seems at face value. The
> MCI_WAIT and MCI_NOTIFY system used with
> mciSendString and mciSendCommand is giving me trouble.
MCI is over a decade old. It was released at a time when there were no true
console applications, just DOS applications that ran under a different VM
than 16 bit Windows.
> If I use MCI_WAIT to wait until playback finishes,
> the only control I can give the user is the ability to
>press a break key to stop waiting. And I can't use
> MCI_NOTIFY in a Console application because I
> don't have a window handle to pass.
There is no law that says that a console program can't have a window.
Similarly there is no law that says a non-console application must display
windows.
> So how can I create a versatile program that uses audio CDs, given these
limitations?
So, you have at least two ways to use MCI. Your console application can
create windows and spin a message loop (on 2K and XP you might want to check
the docs for the meaning of the HWND_MESSAGE flag which creates invisible,
message-only windows) or you can build a gui application by replacing main()
with WinMain() and simply choose not to display the window(s) that you
create.
> Is there another set of commands, different from the MCI commands, that I
should use?
It turns out the both the 9x platforms and NT platform (NT/2K/XP/2K+3)
provide an ASPI-like interface that permits device control by sending SCSI
like commands, even in the case where the device is ATAPI.
> Will I have to interact directly with the CD-ROM drivers? If so, how do I
do that?
Do a google search for SendASPI32Command() for information on the barely
documented ASPI interface for 9x.
For NT/2K/XP/2K+3 you can look at the SPTI (SCSI pass-through interface)
sample in the device driver kit. If I remember correctly, to use SCSI you
need admin privileges.
Regards,
Will
- Previous message: Mehul Sachdev: ".wav file recording"
- In reply to: William DePalo [MVP VC++]: "Re: MCI Devices in Console Apps"
- Next in thread: William DePalo [MVP VC++]: "Re: MCI Devices in Console Apps"
- Reply: William DePalo [MVP VC++]: "Re: MCI Devices in Console Apps"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|