Edit

WINI3CTARGETINITIALIZEDCALLBACK callback function (wini3c.h)

The client-defined callback invoked by the WinI3C library when a WinI3C-Target has been successfully initialized. The callback is supplied to WinI3CInitializeTarget.

Syntax

typedef void (CALLBACK* WINI3CTARGETINITIALIZEDCALLBACK)(
    _In_opt_ void* initializedCallbackContext,
    _In_ WinI3CTarget initializedTarget);

Parameters

[in, optional] initializedCallbackContext

The optional client-supplied context to WinI3CInitializeTarget.

NULL if no context was supplied by the client.

The client may destroy this context at any time.

[in] initializedTarget

The initialized WinI3CTarget handle, now valid for operations. It shall be destroyed by the client with WinI3CRelease (at any time), which may be called from within this callback.

Return value

This callback does not return a value.

Remarks

The callback is always invoked on the thread that called WinI3CInitializeTarget, and is invoked before WinI3CInitializeTarget returns S_OK. It is not invoked if WinI3CInitializeTarget fails.

The client shall not throw exceptions from this callback; all exceptions are caught and ignored by the library.

Blocking this callback from returning may block other callback invocations.

Example

#include <wini3c.h>

void main()
{
    ...

    if (FAILED(WinI3CInitializeTarget(
        addedTargetDeviceInterfacePath,
        context,
        EvtTargetInitialized,
        context,
        EvtTargetRemoved)))
    {
        // Handle failure.
    }

    ...
}

void CALLBACK EvtTargetInitialized(
    _In_opt_ void* initializedCallbackContext,
    _In_ WinI3CTarget initializedTarget)
{
    ...
}

void CALLBACK EvtTargetRemoved(
    _In_opt_ void* removedCallbackContext,
    _In_ WinI3CTarget removedTarget)
{
    ...
}

Requirements

Requirement Value
Minimum supported client Windows 11 25H2 October update (build 26200)
Target Platform Windows
Header wini3c.h

See also

WinI3CInitializeTarget

WINI3CTARGETREMOVEDCALLBACK

WinI3CRelease