windows 在 C# 中获取子窗口句柄

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1456353/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 13:10:32  来源:igfitidea点击:

Get child window handles in C#

c#windowswindows-messageswindow-handles

提问by James Cadd

I'm starting a process in C# and then sending Windows messages to that process with SendMessage. Usually I send the messages to Process.MainWindowHandle, but in some instances I might need to find a child window handle and send messages there instead. How would I do that in C# and what are the options for finding child windows (i.e. do a need to know the name of the window or are there other options)?

我在 C# 中启动一个进程,然后使用 SendMessage 将 Windows 消息发送到该进程。通常我将消息发送到 Process.MainWindowHandle,但在某些情况下,我可能需要找到一个子窗口句柄并在那里发送消息。我将如何在 C# 中做到这一点以及查找子窗口的选项是什么(即需要知道窗口的名称还是有其他选项)?

采纳答案by Shay Erlichmen

Take a look at EnumChildWindows(pinvoke.net)

看看EnumChildWindows(pinvoke.net)