Microsoft MVP성태의 닷넷 이야기
.NET : 56. The managed way to retrieve text under the cursor (mouse pointer) [링크 복사], [링크+제목 복사]
조회: 8780
글쓴 사람
정성태 (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);
  }
 }
}

[연관 글]






[최초 등록일: ]
[최종 수정일: 6/26/2013]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-동일조건변경허락 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.

비밀번호

댓글 작성자
 




1  2  3  4  5  6  7  [8] 
NoWriterDateCnt.TitleFile(s)
18정성태7/17/20034006RegistryEx 클래스 (VC++6.0, Win32) 2000.02.28파일 다운로드1
17정성태9/22/20054869Crypto 클래스 (VC++6.0, Win32) [1]파일 다운로드1
16정성태7/17/20034425Win32 Control Spy (Win32)파일 다운로드1
15정성태7/17/20035106RichEdit Control 클래스 (VC ++ 6.0)파일 다운로드1
1  2  3  4  5  6  7  [8]