So I am new to C# and I would like to make an automation that will click few buttons on Win10 Calculator I downloaded LeanRunner Designer and used it's Model Manager to get Calculator button properties of number 5 and I got:
Auto.getWindow({
"className": "ApplicationFrameWindow",
"title": "Calculator"
}).getWindow({
"className": "Windows.UI.Core.CoreWindow",
"title": "Calculator"
}).getGeneric({
"type": "Group",
"automationId": "NumberPad",
"name": "Number pad",
"className": "NamedContainerAutomationPeer"
}).getButton({
"automationId": "num5Button",
"name": "Five",
"className": "Button"
}).click(52, 24);
I transferred getWindow like this and that works
int hwnd=0;
IntPtr hwndChild=IntPtr.Zero;
IntPtr hwndChild2 = IntPtr.Zero;
//Get a handle for the Calculator Application main window
hwnd = FindWindow("ApplicationFrameWindow", "Calculator");
hwndChild = FindWindowEx((IntPtr)hwnd,IntPtr.Zero, "Windows.UI.Core.CoreWindow", "Calculator");
But now I need to click the button and I'm stuck. I know the end result for click is
SendMessage((int)hwndChild2, BM_CLICK, 0, IntPtr.Zero);
But I'm missing the part to get to the button position. I don't want to use SendKeys. Thank you and sorry if I missed something or made it unclear.