Reputation: 369
I want to fetch the handle of a button whose name changes. Now I am able to fetch the handle of a button using the code given below
buttonHandle = FindWindowEx(wnd.hWnd, IntPtr.Zero, "Button", "Find Car");
But in my application the button name changes like
Find Car Changes to Find Bus
but the first word Find is static. Is there any way to dynamically get the handle of buttons when its name changes?
Thanks, Nikil
Upvotes: 1
Views: 1042
Reputation: 18013
Change the "Find Car" to use the text property of the button
buttonHandle = FindWindowEx(wnd.hWnd, IntPtr.Zero, "Button", btnFindButton.Text);
Upvotes: 1