locked
Speech application and control of the microphone in Windows 8 RRS feed

  • Question

  • My company has a speech application that uses accessibility apis on the Windows 7 desktop.  We have control of the microphone and are listening for dictated text while user runs applications on the Desktop.  The UI for our software does not have to be visible for this to happen.  When testing on Windows 8, we have run into an issue with the ability of the user to switch to Metro.  We'd like to be able to detect this and turn off the mic at that point.  Otherwise, we continue to listen and respond to dictated test with undesirable results.  Is this possible to do?
    Wednesday, April 4, 2012 10:16 PM

Answers

  • Hi,

    Please note that the information below is based on MSDN content that’s labeled with “This documentation is preliminary and is subject to change.”

    Your desktop app can be notified when there’s a transition between the desktop, the Start screen, and a Metro style app. The first thing you’d want to do is call CoCreateInstance() supplying a class id of CLSID_MetroMode, which is defined in shobjidl.h. This provides you with an object which implements IMetroMode interface, documented at http://msdn.microsoft.com/en-us/library/windows/desktop/hh404160(v=vs.85).aspx. You can then call the Advise() method to register for notifications, (remembering to call Unadvise() later when you no longer need the notifications.) In order to call Advise(), you need to provide an object of your own which implements the IMonitorModeEvents interface, documented at http://msdn.microsoft.com/en-us/library/windows/desktop/hh404161(v=vs.85).aspx. This means your own implementation of MonitorModeChanged() will get called when there’s a transition to or from either the desktop or a Metro style app, and your own implementation of LauncherVisibilityChange() will get called when the Start screen appears or goes away.

    The mode data supplied with a call to MonitorModeChange(), (which are documented at http://msdn.microsoft.com/en-us/library/windows/desktop/hh404182(v=vs.85).aspx), relate to a specific monitor. In a multi-monitor scenario, one monitor might be showing the desktop, and another monitor might be showing a Metro style app.

    Note that the object you have which implements IMetroMode also allows you to determine which of the desktop, the Start screen or a Metro style app is currently visible, by calling GetMonitorMode() and IsLauncherVisible().

    By using the above you can get the information you need when your app’s starting up, and also be notified as required of changes.

    Thanks,

    Guy

    Monday, April 9, 2012 9:22 PM

All replies

  • Hi,

    Please note that the information below is based on MSDN content that’s labeled with “This documentation is preliminary and is subject to change.”

    Your desktop app can be notified when there’s a transition between the desktop, the Start screen, and a Metro style app. The first thing you’d want to do is call CoCreateInstance() supplying a class id of CLSID_MetroMode, which is defined in shobjidl.h. This provides you with an object which implements IMetroMode interface, documented at http://msdn.microsoft.com/en-us/library/windows/desktop/hh404160(v=vs.85).aspx. You can then call the Advise() method to register for notifications, (remembering to call Unadvise() later when you no longer need the notifications.) In order to call Advise(), you need to provide an object of your own which implements the IMonitorModeEvents interface, documented at http://msdn.microsoft.com/en-us/library/windows/desktop/hh404161(v=vs.85).aspx. This means your own implementation of MonitorModeChanged() will get called when there’s a transition to or from either the desktop or a Metro style app, and your own implementation of LauncherVisibilityChange() will get called when the Start screen appears or goes away.

    The mode data supplied with a call to MonitorModeChange(), (which are documented at http://msdn.microsoft.com/en-us/library/windows/desktop/hh404182(v=vs.85).aspx), relate to a specific monitor. In a multi-monitor scenario, one monitor might be showing the desktop, and another monitor might be showing a Metro style app.

    Note that the object you have which implements IMetroMode also allows you to determine which of the desktop, the Start screen or a Metro style app is currently visible, by calling GetMonitorMode() and IsLauncherVisible().

    By using the above you can get the information you need when your app’s starting up, and also be notified as required of changes.

    Thanks,

    Guy

    Monday, April 9, 2012 9:22 PM
  • The Start screen visibility sample demonstrates the interfaces that Guy mentions.

    --Rob

    Wednesday, April 11, 2012 7:47 PM
  • Thanks Guy and Rob.  Very helpful info.
    Saturday, April 14, 2012 12:29 AM