RE: [GD-Windows] Finding HWND of the current thread
Brought to you by:
vexxed72
From: Andrew G. <ag...@cl...> - 2004-07-15 17:14:51
|
Couldn't you just create a simple hidden window and pass that handle in? Really though if this is a library wouldn't you want to allow the user to pass in a handle and handle the case of being a console app at a higher level... Andy -----Original Message----- From: gam...@li... [mailto:gam...@li...] On Behalf Of Brian Hook Sent: 15 July 2004 17:38 To: gam...@li... Subject: [GD-Windows] Finding HWND of the current thread For my simple audio library I'm stuck doing something a little gross, and that's passing an HWND to the library upon initialization, only because IDirectSound::SetCooperativeLevel() needs an HWND. Now, you CAN use GetDesktopWindow() and NULL, but that's not the correct way and there are supposedly some failure cases when you use those (e.g. multiple instances using GetDesktopWindow()), and God knows what the HWND is really used for in DirectSound and what can happen if you do something like create a hidden window and bind DS to that instead of to your real application window. Anyway, that aside, instead of passing in HWND, I was thinking it might be possible to find the window of the current thread by enumerating all windows in the system and comparing their owner threads with the current thread and using that. Is there anything glaringly wrong with that, other than the potential situation that there is none (e.g. console application) and having to fallback at that point. Brian ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_idG21&alloc_id040&op=click _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_idU5 |