且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

EnumChildWindows或FindWindowEx?

更新时间:2023-11-18 15:36:46

场景。

FindWindowEx函数用于在窗口中搜索具有特定类和可选特定文本的窗口。 EnumChildWindows函数就是枚举子窗口。

The FindWindowEx function is used to search for windows having a particular class and optionally a particular piece of text in the window. The EnumChildWindows function is simply there to enumerate child windows.

我认为表现应该是你最后关注的问题。第一个是选择正确的API。如果你确实搜索特定类的窗口,然后使用FindWindowEx,否则EnumChildWindows。没有任何意义在手实现一个函数使用EnumChildWindows具有与FindWindowEx相同的行为。

I think performance should be your last concern here. The first is choosing the right API. If you are indeed searching for windows of a particular class then use FindWindowEx, otherwise EnumChildWindows. There is no sense in hand implementing a function using EnumChildWindows to have the same behavior as FindWindowEx.

现在选择正确的解决方案后,如果profiler明确告诉您解决方案太慢,那么您应该考虑手动实现更具体的功能。在此之前。

Now after choosing the right solution, if a profiler specifically tells you that the solution is too slow, then you should consider hand implementing a more specific function. Not before.