글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
(연관된 글이 1개 있습니다.)
The managed way to retrieve text under the cursor (mouse pointer)
; http://blogs.msdn.com/b/oldnewthing/archive/2013/04/08/10409196.aspx
///////////////////////////////////////////////////////////////
using System;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Automation;
class Program
{
static Point MousePos {
get { var pos = Control.MousePosition;
return new Point(pos.X, pos.Y); }
}
public static void Main()
{
for (;;) {
AutomationElement e = AutomationElement.FromPoint(MousePos);
if (e != null) {
foreach (var prop in e.GetSupportedProperties()) {
object o = e.GetCurrentPropertyValue(prop);
if (o != null) {
var s = o.ToString();
if (s != "") {
var id = o as AutomationIdentifier;
if (id != null) s = id.ProgrammaticName;
Console.WriteLine("{0}: {1}", Automation.PropertyName(prop), s);
}
}
}
foreach (var pattern in e.GetSupportedPatterns()) {
Console.WriteLine("Pattern: {0}", Automation.PatternName(pattern));
}
Console.WriteLine();
}
System.Threading.Thread.Sleep(1000);
}
}
}
[연관 글]
1 2 3 4 5 6 7 [8]
1 2 3 4 5 6 7 [8]