Skip to main content
IUPnPServiceAsync::BeginQueryStateVariable method

The BeginQueryStateVariable method initiates an asynchronous request for the state variable value from a specific service. Additionally, if opt-in is indicated for a delayed Service Control Protocol Description (SCPD) download and event subscription, and it has not taken place already, this method will initiate SCPD download and event subscription.


HRESULT BeginQueryStateVariable(
  [in]           BSTR             bstrVariableName,
  [in, optional] IUPnPAsyncResult *pAsyncResult,
  [out]          PULONG64         *pullRequestID


bstrVariableName [in]

Specifies the requested state variable value.

pAsyncResult [in, optional]

Pointer to a IUPnPAsyncResult object. When the BeginQueryStateVariable call is complete, UPnP will use the IUPnPAsyncResult::AsyncOperationComplete method to notify the control point.

pullRequestID [out]

Pointer to a 64-bit ULONG value used to identify the asynchronous I/O operation. The UPnP control point must use this handle when ending or cancelling this operation with EndQueryStateVariable.

Return value

Returns S_OK on success. Otherwise, the method returns a COM error code defined in WinError.h or one of the following values:

Return codeDescription

Failed to initiate the asynchronous operation.


The requested state variable, indicated by bstrVariableName, does not exist.


Note  Some values can indicate that an error was received from a UPnP-certified device. For more information, see Device Error Codes.


Event subscription should be completed before querying any evented state variables with this method. If this does not occur, UPNP_E_VARIABLE_VALUE_UNKNOWN is returned, and event subscription will take place internally. As a result, the next BeginQueryStateVariable call will succeed.

Note  For services without evented variables, this method will always behave as expected.


Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]





See also