UiaDisconnectProvider function (uiautomationcoreapi.h)
Releases all references that a particular provider holds to Microsoft UI Automation objects.
HRESULT UiaDisconnectProvider( [in] IRawElementProviderSimple *pProvider );
The provider to be disconnected.
If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
A provider should call this function to clean up UI Automation resources that are associated with a UI element that was destroyed. The DLL associated with the UI element can be safely unloaded after the function returns.
After this function returns, all client requests that are associated with the disconnected provider receive the UIA_E_ELEMENTNOTAVAILABLE error code.
This function cannot be called in response to a call to the SendMessage function. An application cannot make outbound Component Object Model (COM) calls in response to a call to SendMessage, and releasing a provider is typically an outbound COM call. The UiaDisconnectProvider function returns RPC_E_CANTCALLOUT_ININPUTSYNCCALL if the function is called in response to a SendMessage call. You can use the InSendMessageEx function to determine whether a particular message is being handled in response to a SendMessage call.
An application that calls UiaDisconnectProvider should not respond to a re-entrant WM_GETOBJECT message by returning a pointer to the provider that it is trying to disconnect. If the application tries to disconnect a provider, but then calls the UiaReturnRawElementProvider function with that same provider during the disconnect attempt, the provider might not be fully disconnected.
|Minimum supported client||Windows 8 [desktop apps | UWP apps]|
|Minimum supported server||Windows Server 2012 [desktop apps | UWP apps]|