I'm trying to obtain the handle to a window whose class name unfortunately changes (not my process). Only the first part of the class name stays constant (Afx:ControlBar:
). It's also not a top process but rather a subwindow of another window.
I know that for a full string match on the class name, I could use
var controlBar = FindWindowEx(_parentWindow, IntPtr.Zero, "Afx:ControlBar:ac39000", "");
And I also know that I could just iterate through all child windows of _parentWindow
using the childAfter
parameter of FindWindowEx
, but I'm not sure how I'd get the className from the returned IntPtr object.
Is there an easy way to get the desired window handle from a known className substring?