The
ActivateActCtx function activates the specified activation context. It does this by pushing the specified activation context to the top of the activation stack. The specified activation context is thus associated with the current thread and any appropriate side-by-side API functions.
Syntax
BOOL ActivateActCtx(
__in HANDLE hActCtx,
__out ULONG_PTR *lpCookie
);
Parameters
- hActCtx [in]
-
Handle to an
ACTCTX structure that contains information on the activation context that is to be made active.
- lpCookie [out]
-
Pointer to a ULONG_PTR that functions as a cookie, uniquely identifying a specific, activated activation context.
Return Value
If the function succeeds, it returns TRUE. Otherwise, it returns FALSE.
This function sets errors that can be retrieved by calling
GetLastError. For an example, see
Retrieving the Last-Error Code. For a complete list of error codes, see
System Error Codes.
Remarks
The lpCookie parameter is later passed to
DeactivateActCtx, which verifies the pairing of calls to
ActivateActCtx and
DeactivateActCtx and ensures that the appropriate activation context is being deactivated. This is done because the deactivation of activation contexts must occur in the reverse order of activation.
The activation of activation contexts can be understood as pushing an activation context onto a stack of activation contexts. The activation context you activate through this function redirects any binding to DLLs, window classes, COM servers, type libraries, and mutexes for any side-by-side APIs you call.
The top item of an activation context stack is the active, default-activation context of the current thread. If a null activation context handle is pushed onto the stack, thereby activating it, the default settings in the original manifest override all activation contexts that are lower on the stack.
Requirements
| Minimum supported client | Windows XP |
| Minimum supported server | Windows Server 2003 |
| Header | Winbase.h (include Windows.h) |
| Library | Kernel32.lib |
| DLL | Kernel32.dll |
See Also
- DeactivateActCtx
- ACTCTX
Send comments about this topic to Microsoft
Build date: 11/12/2009