AccNotifyTouchInteraction 函式 (oleacc.h)
允許輔助技術 (AT) 應用程式,通知系統透過 Windows 自動化 API (與 UI 互動,例如 Microsoft 使用者介面自動化) ,因為使用者有觸控手勢。 這可讓輔助技術通知目標應用程式和系統使用者正在與觸控互動。
語法
HRESULT AccNotifyTouchInteraction(
[in] HWND hwndApp,
[in] HWND hwndTarget,
[in] POINT ptTarget
);
參數
[in] hwndApp
屬於呼叫 AccNotifyTouchInteraction 之 AT 進程的視窗。
[in] hwndTarget
AT 目標自動化專案的最接近視窗。
[in] ptTarget
自動化元素的中心點 (或元素周框) 的點。
傳回值
如果成功,則傳回 S_OK。
如果未成功,則傳回標準 COM 錯誤碼。
備註
此函式需要呼叫進程具有UIAccess或更高許可權。 如果呼叫端沒有必要的許可權, 則對 AccNotifyTouchInteraction 的呼叫會失敗,並傳回 E_ACCESSDENIED。 如需詳細資訊,請參閱 輔助技術的安全性考慮 和 /MANIFESTUAC (在指令清單中內嵌 UAC 資訊) 。
當AT耗用觸控資料 (,例如使用 RegisterPointerInputTarget 函式) 時,AT 透過Windows 自動化 API 與之互動的殼層和應用程式並不知道使用者正在透過觸控互動。 若要讓系統向使用者公開觸控相關功能,AT 必須使用 AccNotifyTouchInteraction 來通知系統正在執行互動以回應使用者觸控輸入。
範例
此程式代碼範例示範如何呼叫 AccNotifyTouchInteraction 函式。
// pTargetElement is the element being interacted with by the user, hwndApp
// represents an HWND owned by the AT.
HRESULT PerformTouchBasedInteraction(IUIAutomationElement *pTargetElement,
HWND hwndApp)
{
HRESULT hr = S_OK;
// Set the focus to the element and then notify the system that the
// interaction is occurring due to a touch gesture. This would also apply
// to pattern-based interactions (such as calls to
// IUIAutomationInvokePattern::Invoke)
hr = pTargetElement->SetFocus();
if (SUCCEEDED(hr))
{
HWND hwndTarget;
POINT ptTarget;
BOOL fGotClickablePoint;
// If the current element does not have a native window handle, an
// alternate method (such as walking up the parent chain) is required
// to get the nearest valid HWND.
hr = pTargetElement->get_CurrentNativeWindowHandle((UIA_HWND *)(&hwndTarget));
if (SUCCEEDED(hr))
{
// If the provider doesn't return a clickable point, an alternate
// method (such as using the bounding rectangle) will be required
// to get the center point of the current element.
hr = pTargetElement->GetClickablePoint(&ptTarget, &fGotClickablePoint);
}
if (SUCCEEDED(hr) && fGotClickablePoint)
{
hr = AccNotifyTouchInteraction(hwndApp, hwndTarget, ptTarget);
}
}
return hr;
}
規格需求
需求 | 值 |
---|---|
最低支援的用戶端 | Windows 8 [僅限傳統型應用程式] |
最低支援的伺服器 | Windows Server 2012 [僅限傳統型應用程式] |
目標平台 | Windows |
標頭 | oleacc.h |
程式庫 | Oleacc.lib |
Dll | Oleacc.dll |