I've see a lot of posts stating that the DirectX audio 
sub-system expects an app to have a window ( *with* the 
current focus ) before it will play any sound?   Yikes!
Is the design this dainbrammaged?  I hope I'm missing 
something VERY OBVIOUS.  
Michael
it can be an invisible window.
--
Phil Taylor
PM : DirectX SDK, Managed DirectX, Windows XP Inbox 3D screensavers, and a
few more bits and bobs.
http://msdn.microsoft.com/directx
This posting is provided "AS IS" with no warranties, and confers no rights.
"Michael Chase" <cha...@comtrix.com> wrote in message
news:2ed901c1fabc$1ea17d20$39ef2ecf@TKMSFTNGXA08...
I guess the question is: What is the best way to play a 
sound with out the window ( visible or invisible ) focus 
issue?  I really don't want the app that created the 
window ( invisible or otherwise ) to have to take the 
focus from other foreground apps.
And thank you, Phil ( Microsoft ), for your swift answers.
Michael
>.
>
this is necessary because DirectX subclasses the window procedure to perform
certain tasks on certain Windows events.
as far as having the focus, that could be a problem, some experimentation is
likely needed. Remember that services were added after DirectX.
--
Phil Taylor
PM : DirectX SDK, Managed DirectX, Windows XP Inbox 3D screensavers, and a
few more bits and bobs.
http://msdn.microsoft.com/directx
This posting is provided "AS IS" with no warranties, and confers no rights.
"Michael Chase" <cha...@comtrix.com> wrote in message
news:331901c1fad0$768e3fa0$3bef2ecf@TKMSFTNGXA10...
Regards,
-- 
Alan Ludwig
Software Design Engineer -- Windows AV Platform -- Microsoft
HWND hWnd = GetForegroundWindow();
if( hWnd == NULL )hWnd = GetDesktopWindow();
Use hWnd and set the DSBCAPS_GLOBALFOCUS bit on 
creation of buffers...  Viola!
Thanks. That did it.
>.
>
> Ahhh...  A real answer, so this is the way right?
> 
> HWND hWnd = GetForegroundWindow();
> if( hWnd == NULL )hWnd = GetDesktopWindow();
Actually, you shouldn't use the foreground window. There is no gaurentee that 
your app has the focus at the exact time that the function is called. If that 
isn't your window, you have no control over its lifetime.  It may disappear 
before you're done with your sound.
If you are going to use this technique you are better off with a window that 
you can gaurentee will be around at least as long as your process.  Use the 
desktop window or the console window, not just some random window.
Regard,