Compartilhar via


ILogicalSensorManager::Uninstall method

[ILogicalSensorManager::Uninstall is no longer available for use as of Windows 8.]

Uninstalls the specified logical sensor.

Syntax

HRESULT Uninstall(
  [in] REFGUID logicalID
);

Parameters

  • logicalID [in]
    REFGUID that identifies the logical sensor to uninstall.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code/value Description
S_OK

The method succeeded.

HRESULT_FROM_WIN32(ERROR_OBJECT_NOT_FOUND) 0x800710d8

The object identifier does not represent a valid object. Do not call this method to try to uninstall a disconnected sensor.

 

Remarks

The process that calls this method must have the SE_LOAD_DRIVER_NAME privilege. A process running in the system or in the administrator context can elevate its privilege by using the LookupPrivilegeValue and AdjustTokenPrivileges functions.

Calling this method after a sensor has disconnected will cause an error.

If a user uninstalls a logical sensor through Device Manager, the logical sensor will reinstall the next time Windows scans for hardware changes. To permanently remove the logical sensor, you must call this method.

Examples

The following example code creates a helper function that uninstalls a logical sensor.

HRESULT UninstallLogicalSensor(REFGUID guidLogicalID)
{
    HRESULT hr = S_OK;

    ILogicalSensorManager* pLSM;
 
    // Create the logical sensor manager.
    hr = CoCreateInstance(CLSID_LogicalSensorManager, 
                            NULL, 
                            CLSCTX_INPROC_SERVER, 
                            IID_PPV_ARGS(&pLSM));
 
    if(SUCCEEDED(hr))
    {
        hr = pLSM->Uninstall(guidLogicalID);
    }

    SafeRelease(&pLSM);

    return hr;
}

Requirements

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

None supported

End of client support

Windows 7

Header

Sensorsapi.h

Library

Sensorsapi.lib

DLL

Sensorsapi.dll

See also

About Logical Sensors

ILogicalSensorManager

Using Logical Sensors