4

I need some help about the win32 api and especially WindowsFromDc.

I have a application which hook a another application. This two application communicate by a NamedPipe. In the second application, I have hook the DrawTextExW function and I get a HDC from this function.

But when I do a WindowsFromDC with the DC returned by the DrawTextEx function, i got a null return.

So, I have some question about that : -Is it possible a HDC don't have a HDWN with ? -How I can get the HWND of the window which call DrawTextEx ? There are other way do to that ?

Thank you.

Ps : Sorry for my bad english...

4

1 回答 1

3

跨进程传递时,设备上下文句柄无效。所以你试图做的事情是不可能的。

至于你的其他问题:

是否有可能有一个HDC与一个不相关的HWND

是的,这是完全可能的。许多设备上下文与窗口无关。

如何获取HWND调用 DrawTextEx 的窗口?

Windows 不调用函数,代码调用函数。所以,这个问题并没有真正的意义。

于 2013-04-23T12:23:55.497 回答