I have option to use any one of the API EnumChildWindows or FindWindowEx.
Any suggestions which api is better performance oriented?
Is FindWindowEx internally uses EnumChildWindows to get handle to particular window?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This really depends a lot on your scenario.
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.
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.
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.