Share via


IUIAutomationTextPattern::RangeFromPoint 方法 (uiautomationclient.h)

擷取最接近指定螢幕座標的空白 (空白) 文字範圍。

語法

HRESULT RangeFromPoint(
  [in]          POINT                  pt,
  [out, retval] IUIAutomationTextRange **range
);

參數

[in] pt

類型: POINT

結構,包含螢幕座標中的位置。

[out, retval] range

類型: IUIAutomationTextRange**

接收最接近指定位置之變質文字範圍的指標。

傳回值

類型: HRESULT

如果此方法成功,則會傳回 S_OK。 否則,它會傳回 HRESULT 錯誤碼。

備註

如果螢幕座標位於影像、超連結、Microsoft Excel 電子表格或其他內嵌物件的座標內,則會傳回包裝子物件的文字範圍。

因為不會忽略隱藏的文字,所以此方法會從最接近指定座標的可見文字擷取變質範圍。

Windows Internet Explorer 9 中 RangeFromPoint 的實作不會傳回預期的結果。 相反地,客戶端應該:

  1. 呼叫 GetVisibleRanges 方法來擷取可見文字範圍的數位。
  2. 針對陣列中的每個文字範圍,呼叫 IUIAutomationTextRange::GetBoundingRectangles 以擷取周框。
  3. 檢查周框以尋找佔用特定螢幕座標的文字範圍。

規格需求

需求
最低支援的用戶端 Windows 7、Windows Vista sp2 和 Platform Update for Windows Vista、Windows XP with SP3 和 Platform Update for Windows Vista [僅限桌面應用程式]
最低支援的伺服器 Windows Server 2008 R2、Windows Server 2008 SP2 和 Platform Update for Windows Server 2008、Windows Server 2003 SP2 和 Platform Update for Windows Server 2008 [僅限桌面應用程式]
目標平台 Windows
標頭 uiautomationclient.h (包含 UIAutomation.h)

另請參閱

IUIAutomationTextPattern

使用者介面自動化 文字內容的支援