|Microsoft DirectX 9.0|
The concept of capturing focus is integral to creating lobbyable game applications and lobby applications with Microsoft?DirectPlay?Voice support. If your game application does not properly implement focus capture, it is possible that voice communication will not function if your game was launched from a lobby application.
To illustrate this point, consider two players who meet in a lobby application that has DirectPlay Voice support. The two players agree to launch the game. After the game is launched, the lobby application loses focus on each player's computer, and each copy of the game application gains focus. If the game application does not properly gain focus from the lobby application, it is possible that the lobby application can still have focus while the game application is running.
For example, this will occur if the first player's lobby application retains focus while the game session is running while the second player's game session gains focus from the lobby application. From the second player's perspective, the first player's voice session has fallen back to half-duplex. The second player can hear the first player, but the first player cannot hear the second player. From the first player's perspective, the voice session has ended because the second player does not seem to be speaking. Also, the first player does not know that the second player can hear him or her.
Note that this behavior is by design. Consider the same scenario as above, but when the first player attempts to start the game session from the lobby application, there is a problem and the session fails to start. If the second player's session starts successfully, that player can hear the voice of the first player and the first player can inform the second player that their game session failed. Both players might then drop back to the lobby and attempt to start the session once again.
To handle capture focus properly, your game application must set the hwndAppWindow parameter in the DVSOUNDDEVICECONFIG structure to the window handle that will have focus when the game is running. The DirectPlay Voice session can then be created through a call to IDirectPlayVoiceClient::Connect. The game application must then handle the DVMSGID_LOSTFOCUS and DVMSGID_GAINFOCUS messages.
See Sharing the Audio Capture Device for more information.