How do I get a HWND from inside a DLL?

前端 未结 2 760
我在风中等你
我在风中等你 2021-01-13 10:38

I have a DLL that I want to play sounds using Direct Sound. In order to play sounds, I need the HWND of the executable. I don\'t have a HWND of the executable that loads t

2条回答
  •  死守一世寂寞
    2021-01-13 11:41

    Call GetGUIThreadInfo on the main thread. This gets you a bunch of HWNDs. If you need a top-level HWND, pick any valid one (not all values may be filled) and find its top level ancestor with GetAncestor(GA_ROOT).

提交回复
热议问题