Partager via


ActivateDevice (Windows CE 5.0)

Send Feedback

This function loads a device driver. For additional functionality, use the ActivateDeviceEx function.

HANDLE ActivateDevice(LPCWSTR lpszDevKey, DWORD dwClientInfo);

Parameters

  • lpszDevKey
    [in] Pointer to a string that identifies the location under the HKEY_LOCAL_MACHINE registry subtree where the Driver registry subkey for the device resides. A driver registry subkey contains the dynamic-link library (DLL) name, device prefix, friendly name, and other device information.
  • dwClientInfo
    [in] Data to store in the Active registry subkey for the device in the ClientInfo registry entry. The registry path to the Active registry subkey for the device is passed in as the context parameter to the device's XXX_Init (Device Manager) function. After the value in dwClientInfo is stored in the registry under HKEY_LOCAL_MACHINE\Drivers\Active, the Device Manager calls XXX_Init. Devload.h defines DEVLOAD_CLIENTINFO_VALNAME and DEVLOAD_CLIENTINFO_VALTYPE to facilitate access to the ClientInfo key.

Return Values

Returns a handle to the device that you can use in subsequent calls to the DeactivateDevice function, if successful. If the function is not successful, it returns INVALID_HANDLE_VALUE. To obtain extended error information, call GetLastError.

Remarks

ActivateDevice loads a device driver and reads the registry key specified in lpszDevKey to get the DLL name, device prefix, index, and other values. Next, it adds the device to the active device list in the HKEY_LOCAL_MACHINE\Drivers\Active registry key, and stores the relevant values there. If you do not specify a device index in the registry subkey specified in lpszDevKey, then ActivateDevice assigns a free index. Then, ActivateDevice loads the device driver DLL in the process space of the Device Manager. Finally, the Device Manager sends a device notification message for the new device. For more information on device notifications, see Device Interface Notifications.

If the entire OS must recognize the driver, and your applications must load custom-purpose device drivers, use ActivateDevice.

Requirements

OS Versions: Windows CE 2.11 and later.
Header: Winbase.h.
Link Library: Coredll.lib.

See Also

Device Interface Notifications | ActivateDeviceEx | DeactivateDevice | RegisterDevice | XXX_Init (Device Manager)

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.