简体   繁体   English

如何从具有特定HWND的窗口中获取文本?

[英]how to get text from a window with specific HWND?

I'm new to win32 programming and haven't worked around with cpp for a long time. 我是Win32编程的新手,很长一段时间都没有使用cpp。 What I intend to do is to get a window's HWND via spy++, and get the text of this window. 我打算做的是通过spy ++获取窗口的HWND,并获取该窗口的文本。 The problem is that I don't know how to create a HWND object, could anyone give me some idea? 问题是我不知道如何创建HWND对象,有人可以给我一些想法吗? Thanks a lot! 非常感谢!

If you have the numeric value of the HWND, you can cast it to the right type. 如果您具有HWND的数值,则可以将其转换为正确的类型。 Start with an integer of the right size, eg: 以正确大小的整数开头,例如:

uintptr_t numeric_hwnd = 0x987654;
HWND hwnd = reinterpret_cast<HWND>(numeric_hwnd);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM