Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 30th, 2012  |  syntax: None  |  size: 0.61 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Identifier for a Windows GUI element (AutomationElement HashCode and RuntimeID)
  2. using System.Window.Automation;        
  3. private AutomationElement element;
  4. System.Drawing.Point mouse = System.Windows.Forms.Cursor.Position;
  5. this.element = AutomationElement.FromPoint(new System.Windows.Point(mouse.X, mouse.Y));
  6.        
  7. [DllImport("User32.dll")]
  8.     public static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
  9.  
  10. private string GetClassName(IntPtr hWnd)
  11.     {
  12.         StringBuilder sb = new StringBuilder(256);
  13.         this.GetClassName(hWnd, sb, 256);
  14.         return sb.ToString();
  15.     }