Getting HWND of current Process

后端 未结 7 907
攒了一身酷
攒了一身酷 2020-12-17 10:33

I have a process in c++ in which I am using window API. I want to get the HWND of own process. Kindly guide me how can I make it possible.

7条回答
  •  无人及你
    2020-12-17 11:09

    You are (incorrectly) assuming that a process has only a single HWND. This is not generally true, and therefore Windows can't offer an API to get it. A program could create two windows, and have two HWNDs as a result. OTOH, if your program creates only a single window, it can store that HWND in a global variable.

提交回复
热议问题