static void Main(string[] args) { Engine e = new Engine(); Window w = e.GetWindow("SomeForm"); if (w == null) { Console.WriteLine("Window not found"); } else { bool dddd = false; IWinControl ctrl = w.GetControl("OK", typeof(Button)); string ssss; if (ctrl != null) { ssss = (string)ctrl.GetPropertyValue("Name", out dddd); ctrl.Invoke("OnClick", new object[] { new EventArgs() }); } IWinControl ctrl2 = w.GetControl("this", typeof(Form)); string ssss2; if (ctrl != null) { ssss2 = (string)ctrl2.GetPropertyValue("Text", out dddd); } List <IWinControl> ctrls = w.GetControls(typeof(Button)); if (ctrls != null) { foreach (IWinControl item in ctrls) { bool bsuccess = false; string str = (string)item.GetPropertyValue("Text", out bsuccess); Console.WriteLine(str); item.SetPropertyValue("Text", "Changed"); } } } while (true) { Console.WriteLine("Inside while"); Thread.Sleep(1000); } //IHookInterfaces.IWinForm win = engine.FindWindow("Form1", 20); /// IWinControl ctrl = win.GetControl("OK", typeof(Button)); /// SizeF s = new SizeF(3, 3); /// ctrl.Invoke("Scale", new object[] { s }); }
public object Invoke(string functionName, object[] parameters, BindingFlags flags = BindingFlags.Default) { try { return(m_WinControl.Invoke(functionName, parameters, flags)); } catch (SerializationException ex) { } catch (Exception ex) { return(null); } Type typeOfControl; int i = 0; try { object[] remotableParamsters = new Object[parameters.Length]; foreach (object item in parameters) { typeOfControl = item.GetType(); if (typeOfControl.IsValueType)//value types generally do not cause serialization issues { remotableParamsters[i++] = item; continue; } object inst = Serialize(item); remotableParamsters[i++] = inst; } return(m_WinControl.Invoke(functionName, remotableParamsters, flags)); } catch (Exception ex) { return(null); } }