RE: [GD-Windows] Finding HWND of the current thread
Brought to you by:
vexxed72
From: Mat N. \(BUNGIE\) <mat...@mi...> - 2004-07-15 17:14:17
|
Useful functions: EnumThreadWindows GetConsoleWindow And for a brute force window search: GetWindowThreadProcessId MSN -----Original Message----- From: gam...@li... [mailto:gam...@li...] On Behalf Of Brian Hook Sent: Thursday, July 15, 2004 9:38 AM 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,=20 and that's passing an HWND to the library upon initialization, only=20 because IDirectSound::SetCooperativeLevel() needs an HWND. Now, you CAN use GetDesktopWindow() and NULL, but that's not the=20 correct way and there are supposedly some failure cases when you use=20 those (e.g. multiple instances using GetDesktopWindow()), and God=20 knows what the HWND is really used for in DirectSound and what can=20 happen if you do something like create a hidden window and bind DS to=20 that instead of to your real application window. Anyway, that aside, instead of passing in HWND, I was thinking it=20 might be possible to find the window of the current thread by=20 enumerating all windows in the system and comparing their owner=20 threads with the current thread and using that. Is there anything glaringly wrong with that, other than the potential=20 situation that there is none (e.g. console application) and having to=20 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_id=10040&op=3Dick _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_idU5 |