مشاركة عبر


كشف جانب الخادم واجه المستخدم أتمتة موفر

ملاحظةملاحظة

Th هو الوثائق هو المقصودة لإطار عمل.NET المطورين الذين يرغبون في استخدام المدارة UI Automationالفئات المعرفة في System.Windows.Automationمساحة الاسم.للحصول على أحدث المعلومات حول UI Automation، راجع API التنفيذ التلقائي Windows: أتمتة واجه المستخدم.

Th هو الموضوع يحتوي على تعليمات برمجية مثال يوضح كيفية كشف على جانب الملقم "التنفيذ التلقائي لواجهة مستخدم" موفر التي هو التي تتم استضافتها في System.Windows.Forms.Controlالإطار.

يتجاوز المثال إجراء نافذة إلى اعتراض WM_GETOBJECT، الذي هو الرسالة المرسلة من قبل UI Automationالخدمة الأساسية عند معلومات طلبات تطبيق العميل حول النافذة.

مثال

    ''' <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 'WndProc

/// <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);
}

راجع أيضًا:

المبادئ

واجه المستخدم أتمتة نظرة عامة حول موفري

تطبيق موفر التنفيذ التلقائي لواجهة المستخدم من جانب الخادم