InitOnceComplete function (Windows)

Switch View :
ScriptFree
InitOnceComplete function

Applies to: desktop apps | Metro style apps

Completes one-time initialization started with the InitOnceBeginInitialize function.

Syntax

BOOL WINAPI InitOnceComplete(
  __inout   LPINIT_ONCE lpInitOnce,
  __in      DWORD dwFlags,
  __in_opt  LPVOID lpContext
);

Parameters

lpInitOnce [in, out]

A pointer to the one-time initialization structure.

dwFlags [in]

This parameter can be one of the following flags.

ValueMeaning
INIT_ONCE_ASYNC
0x00000002UL

Operate in asynchronous mode. This enables multiple completion attempts to execute in parallel. This flag must match the flag passed in the corresponding call to the InitOnceBeginInitialize function. This flag may not be combined with INIT_ONCE_INIT_FAILED.

INIT_ONCE_INIT_FAILED
0x00000004UL

The initialization attempt failed. This flag may not be combined with INIT_ONCE_ASYNC. To fail an asynchronous initialization, merely abandon it (that is, do not call the InitOnceComplete function).

 

lpContext [in, optional]

A pointer to the data to be stored with the one-time initialization structure. This data is returned in the lpContext parameter passed to subsequent calls to the InitOnceBeginInitialize function. If lpContext points to a value, the low-order INIT_ONCE_CTX_RESERVED_BITS of the value must be zero. If lpContext points to a data structure, the data structure must be DWORD-aligned.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

To compile an application that uses this function, define _WIN32_WINNT as 0x0600 or later. For more information, see Using the Windows Headers.

Examples

For an example that uses this function, see Using One-Time Initialization.

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Header

WinBase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

InitOnceBeginInitialize
One-Time Initialization
Synchronization Functions

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012