private void buttonBaseline_Click(object sender, EventArgs e) { if (radioButtonDotNET.Checked) { m_APE.AddFirstMessageDumpControl(); } else { m_APE.AddFirstMessageDumpActiveX(); } m_APE.SendMessages(EventSet.APE); m_APE.WaitForMessages(EventSet.APE); string res = m_APE.GetValueFromMessage(); if (string.IsNullOrEmpty(res)) { Baseline = new List <string>(); } else { string[] splitSeparator = { "\r\n" }; Baseline = res.Split(splitSeparator, StringSplitOptions.None).ToList(); labelBaselineCount.Text = Baseline.Count.ToString(); } }
/// <summary> /// Checks if the attached application supports visual styles /// </summary> /// <returns>True if it does otherwise false</returns> public static bool AttachedProcessVisualStyleSupported() { m_APE.AddFirstMessageVisualStyleSupported(); m_APE.SendMessages(EventSet.APE); m_APE.WaitForMessages(EventSet.APE); bool visualStyleSupported = GUI.m_APE.GetValueFromMessage(); return(visualStyleSupported); }
/// <summary> /// Performs a garbage collection using the specified generation in both this and the application being automated /// </summary> /// <param name="generation"></param> public static void GarbageCollect(int generation) { m_APE.AddFirstMessageGarbageCollect(generation); m_APE.SendMessages(EventSet.APE); m_APE.WaitForMessages(EventSet.APE); GC.Collect(); GC.WaitForPendingFinalizers(); }
private void GetIdentity(IntPtr Parent, IntPtr Handle) { m_Identity = new ControlIdentifier(); try { if (Parent != Handle) { m_Identity.ParentHandle = Parent; } m_Identity.Handle = Handle; m_APE.AddFirstMessageFindByProperty(m_Identity); m_APE.SendMessages(EventSet.APE); m_APE.WaitForMessages(EventSet.APE); m_APE.DecodeControl(1, out m_Identity); } catch (Exception ex) { Debug.WriteLine("GetIdentity by handle failed " + Parent.ToString() + " " + Handle.ToString() + ": " + ex.Message + "\r\n" + ex.StackTrace.ToArray()); //if (NM.IsTopLevelWindow(m_Identity.Handle)) //{ // IntPtr menu = NM.GetMenu(m_Identity.Handle); // if (menu == IntPtr.Zero) // { // IntPtr contextMenu = NM.GetContextMenu(m_Identity.Handle); // if (contextMenu != IntPtr.Zero) // { // Debug.WriteLine("----- " + NM.GetMenuString(contextMenu, 0, NM.GetMenuFlag.MF_BYPOSITION)); // } // } // else // { // Debug.WriteLine("----- " + NM.GetMenuString(menu, 0, NM.GetMenuFlag.MF_BYPOSITION)); // } //} } }