2012-06-20 7 views
1

3 개의 목록 (SysListView32)이있는 창에서 데이터를 가져 오려고합니다. 나는 UISpy와 Inspect 두 가지 모두에서 행과 셀을 볼 수 있지만 그 중 두 개가 완벽하게 작동 할 때 (Caption = "List2"및 Caption = "List3"), 세 가지 항목에 대해 동일한 작업을 수행하지만 세 번째는 빈 흰색 문자열 만 포함합니다.AutomationElement에서 행 셀 값을 찾을 수 없습니다 (단 UISpy는 수행합니다)

내가하려고하면 :

IntPtr PrizeListHandle = Win32Utils.FindWindowByCaption(Lobby, "List1"); 
IUIAutomationElement dataGridPrizes = autom.ElementFromHandle(PrizeListHandle); 
IUIAutomationGridPattern gridPrizes = dataGridPrizes.GetCurrentPattern(10006); 

string linea = gridPrizes.GetItem(0, 0).CurrentName; 

원격 교육이 gridPrizes 17 행 3 열이 있고, 빈 문자열로 전환, 모든 셀이 빈 문자열입니다.

내가하려고하면 :

IntPtr PrizeListHandle = Win32Utils.FindWindowByCaption(Lobby, "List1"); 
IUIAutomationElement dataGridPrizes = autom.ElementFromHandle(PrizeListHandle); 
int propIdClassName = 30004; // UIA_ClassNamePropertyId; 
IUIAutomationPropertyCondition conditionListItem = (IUIAutomationPropertyCondition)autom.CreatePropertyCondition(propIdClassName, "list item"); 
IUIAutomationElementArray children = dataGridPrizes.FindAll(interop.UIAutomationCore.TreeScope.TreeScope_Children, conditionListItem); 

int i = children.Length; 

내가은 0 왜?

UISpy를 사용할 때 모든 것을 발견한다는 점에 유의해야합니다. 또한 자동화에 대한 관리되지 않는 버전과 동일한 정확한 결과를 모두 관리하도록 노력했습니다.

Windows Server 2008 R2를 사용하고 있습니다. enter image description here

미리

답변

0

당신은 ScrollItemPattern.ScrollIntoView를 사용할 필요가()에 감사가보기에 가져 :

여기 스크린 샷입니다.

var pattern = (ScrollItemPattern)aeDataGridCell 
    .GetCurrentPattern(ScrollItemPatternIdentifiers.Pattern); 
pattern.ScrollIntoView();