Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Initializes a one-time initialization structure.
void InitOnceInitialize(
[out] PINIT_ONCE InitOnce
);
[out] InitOnce
A pointer to the one-time initialization structure.
None
The InitOnceInitialize function is used to initialize a one-time initialization structure dynamically. To initialize the structure statically, assign the constant INIT_ONCE_STATIC_INIT to the structure variable.
To compile an application that uses this function, define _WIN32_WINNT as 0x0600 or later. For more information, see Using the Windows Headers.
A one-time initialization object cannot be moved or copied. The process must not modify the initialization object, and must instead treat it as logically opaque. Only use the one-time initialization functions to manage one-time initialization objects.
The following example calls InitOnceInitialize to initialize the one-time initialization structure named InitOnce
. Alternatively, the structure can be declared as a global variable as shown in Using One-Time Initialization.
//Requires Windows Vista, Windows Server 2008 or later
#define _WIN32_WINNT 0x0600
#include <windows.h>
BOOL StartInitialization()
{
INIT_ONCE InitOnce;
InitOnceInitialize(&InitOnce);
//...
return TRUE;
}
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2008 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | synchapi.h (include Windows.h on Windows 7, Windows Server 2008 Windows Server 2008 R2) |
Library | Kernel32.lib |
DLL | Kernel32.dll |
Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!