일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 |
- JAVA 언어
- C#
- 디딤돌 C++
- gof의 디자인 패턴
- 소프트웨어 설계
- 설계 패턴
- 동적 메모리 할당
- 클래스 다이어그램
- java
- 무료 Java
- 소스 구현
- 디딤돌 Java 언어 Part1
- C언어 표준 라이브러리 함수 가이드
- XML.NET
- StringBuffer 클래스
- C언어 소스 코드
- C언어 소스
- 소프트웨어 접근성
- 소스 파일
- 파일 입출력
- 알고리즘
- Escort GoF의 디자인 패턴
- String 클래스
- math.h
- C++
- 디딤돌 C언어
- 소스 코드
- C언어
- C# 소스 코드
- C언어 표준 라이브러리 함수 사용법 가이드
- Today
- 2
- Total
- 98,400
프로그램 소스
[S/W 접근성] TreeWalker로 윈도우 패턴과 Enable 조건 요소 검색 본문
TreeWalker로 윈도우 패턴과 Enable 조건 요소 검색
응용 프로그램 설명
TreeWalker를 이용하여 윈도우 패턴과 Enable 상태를 만족하는 자동화 요소만 조사하여 콘솔 화면에 출력
응용 프로그램 유형
C# 콘솔 응용 프로그램
요구 조건
UI 자동화 .NET 어셈블리 참조(솔루션 탐색기에서 프로젝트 참조 노드에 마우스 오른쪽 버튼 클릭하여 컨텍스트 메뉴의 참조 추가 선택)
using System;
using System.Windows.Automation;
using System.Runtime.InteropServices;
namespace 자동화_트리_개체_생성
{
static class WrapApi
{
[DllImport("user32")]
internal static extern IntPtr GetDesktopWindow();
}
class Program
{
static void Main(string[] args)
{
AutomationElement ae = AutomationElement.FromHandle(
WrapApi.GetDesktopWindow());
ListAE(ae, 0);
}
private static void ListAE(AutomationElement ae, int depth)
{
Condition cond1 = new PropertyCondition(AutomationElement.IsWindowPatternAvailableProperty, true);
Condition cond2 = new PropertyCondition(AutomationElement.IsEnabledProperty, true);
Condition condition = new AndCondition(cond1, cond2);
TreeWalker tw = new TreeWalker(condition);
if (ae == null)
{
return;
}
ViewAE(ae, depth);
AutomationElement cae = tw.GetFirstChild(ae);
while (cae != null)
{
ListAE(cae, depth + 1);
cae = tw.GetNextSibling(cae);
}
}
private static void ViewAE(AutomationElement ae, int depth)
{
Console.WriteLine("{0}:{1}", ae.Current.Name, depth);
}
}
}
'소프트웨어 접근성, UI 자동화' 카테고리의 다른 글
[S/W 접근성] TreeWalker로 요소름 포함하는 윈도우 탐색 (2) | 2016.04.19 |
---|---|
[S/W 접근성] TreeWalker로 윈도우 패턴과 Enable 조건 요소 검색 (0) | 2016.04.19 |
[S/W 접근성] TreeWalker를 이용하여 데스크 톱의 자식 요소 조사 (0) | 2016.04.19 |
[S/W 접근성] 화면 좌표로 UI 요소 탐색 후 속성 타입 얻어오기 (0) | 2016.04.19 |
[S/W 접근성] 화면 좌표로 InvokePattern 검색 (0) | 2016.04.19 |
[S/W 접근성] 화면 좌표로 UI 요소 탐색 (0) | 2016.04.19 |