I was writing a function to get the handle of current active window in the Application. For that I am using Extern.Declare to declare and use WinAPI functions. I need to use EnumChildWindows which will enumerate through the child window by passing the top window handle using GetTopWindow WinAPI.
EnumChildWindows has a parameter that is a pointer to an application-defined callback function, which I understand, is a limitation of the Extern object. What could be the workaround for this?
My algorithm is something like this :
Dim hwnd ‘(Handle of my main Application)
top_hwnd = GetTopWindow (hwnd)
parent_hwnd = GetWindow (top_hwnd, GW_CHILD) ‘I need to do this to get the application handle since QTP/UFT gets confused with the Application handle and Ribbon handle
GetWindowHandleByClass(parent_hwnd , ClassName_child)