Question

I want to find handle of a window whose title may be of type *.log where *.log could be temp.log, dummy.log etc.

I dont know the title but i know the extension of log type.

I know FindWindow API is used for finding the handle of the window but there we need to know the title name. So if i dont know anything about the window only knows the extension then how to retrieve the handle for the same using c++?

Was it helpful?

Solution

You can use EnumWindows for top-level windows and and GetWindowText to retrieve the title.

PathMatchSpec should work for your pattern matching.

GetWindowText makes sure you don't "stall" if the process you are asking is not responding.

OTHER TIPS

Haven't use the WinAPI for years, but if memory serves me, there is an EnumWindows function that you use in such a case.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top