AutomationInteropProvider.ReturnRawElementProvider 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
傳回項目的使用者介面自動化提供者,以回應 WM_GETOBJECT
訊息。
public:
static IntPtr ReturnRawElementProvider(IntPtr hwnd, IntPtr wParam, IntPtr lParam, System::Windows::Automation::Provider::IRawElementProviderSimple ^ el);
public static IntPtr ReturnRawElementProvider (IntPtr hwnd, IntPtr wParam, IntPtr lParam, System.Windows.Automation.Provider.IRawElementProviderSimple el);
static member ReturnRawElementProvider : nativeint * nativeint * nativeint * System.Windows.Automation.Provider.IRawElementProviderSimple -> nativeint
Public Shared Function ReturnRawElementProvider (hwnd As IntPtr, wParam As IntPtr, lParam As IntPtr, el As IRawElementProviderSimple) As IntPtr
參數
- hwnd
-
IntPtr
nativeint
項目視窗的控制代碼。
- wParam
-
IntPtr
nativeint
WM_GETOBJECT
訊息的 wParam
成員。
- lParam
-
IntPtr
nativeint
WM_GETOBJECT
訊息的 lParam
成員。
項目的使用者介面自動化提供者。
傳回
IntPtr
nativeint
應該指派給 Result,再將訊息傳遞至基底視窗程序的資料指標。
範例
/// <summary>
/// Handles WM_GETOBJECT message; others are passed to base handler.
/// </summary>
/// <param name="m">Windows message.</param>
/// <remarks>
/// This method enables UI Automation to find the control.
/// In this example, the implementation of IRawElementProvider is in the same class
/// as this method.
/// </remarks>
protected override void WndProc(ref Message m)
{
const int WM_GETOBJECT = 0x003D;
if ((m.Msg == WM_GETOBJECT) && (m.LParam.ToInt32() ==
AutomationInteropProvider.RootObjectId))
{
m.Result = AutomationInteropProvider.ReturnRawElementProvider(
this.Handle, m.WParam, m.LParam,
(IRawElementProviderSimple)this);
return;
}
base.WndProc(ref m);
}
''' <summary>
''' Handles WM_GETOBJECT message; others are passed to base handler.
''' </summary>
''' <param name="m">Windows message.</param>
''' <remarks>
''' This method enables UI Automation to find the control.
''' In this example, the implementation of IRawElementProvider is in the same class
''' as this method.
''' </remarks>
Protected Overrides Sub WndProc(ByRef m As Message)
Const WM_GETOBJECT As Integer = &H3D
If m.Msg = WM_GETOBJECT AndAlso m.LParam.ToInt32() = AutomationInteropProvider.RootObjectId Then
m.Result = AutomationInteropProvider.ReturnRawElementProvider(Me.Handle, m.WParam, m.LParam, DirectCast(Me, IRawElementProviderSimple))
Return
End If
MyBase.WndProc(m)
End Sub