ActivateDevice

This function loads a device driver in the manner that the plug and play system loads a device driver.

HANDLE ActivateDevice(
LPCWSTR lpszDevKey, 
DWORD dwClientInfo);

Paramters

  • lpszDevKey
    Pointer to the registry path string of the device's driver key under HKEY_LOCAL_MACHINE. A driver key contains the DLL name, the device prefix, friendly name, and other device information.
  • dwClientInfo
    Specifies per instance information that is stored in the Active key of the newly loaded device in the entry named ClientInfo.

Return Values

A handle to the device indicates success. Zero indicates failure.

Remarks

ActivateDevice uses the RegisterDevice function to load the device driver, then it adds the device to the active device list under HKEY_LOCAL_MACHINE\Drivers\Active key, then it sends a ii message for the new device and triggers a NOTIFICATION_EVENT_DEVICE_CHANGE event in the application notification system to notify applications system-wide of the presence of the new device.

ActivateDevice returns a handle to the device that can be used in a subsequent call to the DeactivateDevice function, which unloads the device driver, deletes the device's active key, sends a WM_DEVICECHANGE message, and triggers a NOTIFICATION_EVENT_DEVICE_CHANGE.

The registry path to the device's active key is passed in as the context parameter to the device's XXX_Init function. The dwClientInfo value is not stored in the registry before XXX_Init is called.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 2.11 and later Winbase.h   Coredll.lib

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

DeactivateDevice, RegisterDevice, XXX_Init

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.