Jump to content
Mark-

mciSendCommand and MCI_WAIT...

Recommended Posts

Hello,

 

Today, I discovered some code using mciSendCommand with MCI_WAIT and MCI_PLAY, I wrote when Windows 7 was the cat's meow works under W10 and I assume W11 as long as the user has not used CTRL + break on the computer.

 

Searching the web I found a fellow reported the issue in 2016, https://answers.microsoft.com/en-us/windows/forum/all/media-control-interface-nmci-not-working-properly/4931db24-a53a-46da-94db-7423e3d5540f

 

I verified, code works sound plays, press CTRL + break, code says it works, no errors and no sound. Restarting the computer, the code works as long as CTRL + break has not been pressed. And there seems to be another time it might be cleared but, I could not repeat that part.

 

Rewriting the code without using MCI_WAIT is possible but, before I started, I was wondering if anyone has an idea or has found a solution?

 

Thanks,

 

Mark

 

Edited by Mark-

Share this post


Link to post

More testing shows CTRL + Break is a toggle command and it appears after X time it resets to cleared/off.

I do not see a way to query the device for its "break mode" state.

CTRL + Break while another program has focus has the same result as if the program that plays the sound has focus.

I have not found a way to send CTRL + Break to the system.

If a method to query the state and send a CTRL + Break was possible, that would good.

Might have to put a note in the user manual if the sound will not play.

 

Share this post


Link to post

Perhaps the MCI_BREAK command can help you? CTRL+Break is the default for aborting am MCI wait operation, but you can specify a different key, or even disable breaking.

  • Like 1

Share this post


Link to post
5 minutes ago, Remy Lebeau said:

Perhaps the MCI_BREAK command can help you? CTRL+Break is the default for aborting am MCI wait operation, but you can specify a different key, or even disable breaking.

Thanks for the response.

 

I tried a bunch of variations of MC_Break, setting the key, setting it off, etc.. Nothing altered what I am seeing. CTRL+ Break does not stop a sound playing with MCI_Wait or MCI_Notify, as it should. No errors are reported for any calls I am using with success or trying with no success.  Well, unless I fail to open the device.

I use MCI_STOP when the user selects a button and MCI_Notify is used.

 

I do not see a command structure that uses MC_Break and actually says it will stop the sound playing.

The docs do have this: "You might have to press the break key multiple times to interrupt a wait operation. " HA

 

I just tested with MCI_Wait and CTRL+ Break, hit the key pair 30+ times, it did not stop the sound.🙂

 

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×