IUIAutomationElement::GetCurrentPatternAs Method

Retrieves the control pattern interface of the specified pattern on this UI Automation element.

Syntax

HRESULT GetCurrentPatternAs(      
    PATTERNID patternId,
    REFIID riid,
    void **ppv
);

Parameters

  • patternId
    [in] The identifier of the control pattern. For a list of control pattern IDs, see Control Pattern Identifiers.
  • riid
    [in] A reference to the IID of the interface to retrieve through ppv.
  • ppv
    [out] When this method returns successfully, contains the interface pointer requested in riid.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

It is recommended that you use the IID_PPV_ARGS macro, defined in Objbase.h, to package the riid and ppv parameters. This macro provides the correct IID based on the interface pointed to by the value in ppv, which eliminates the possibility of a coding error.

See Also

IUIAutomationElement, IUIAutomationElement::GetCachedPatternAs, IUIAutomationElement::GetCurrentPattern, UI Automation Control Patterns Overview