RegisterGPNotification function (userenv.h)

The RegisterGPNotification function enables an application to receive notification when there is a change in policy. When a policy change occurs, the specified event object is set to the signaled state.

Syntax

USERENVAPI BOOL RegisterGPNotification(
  [in] HANDLE hEvent,
  [in] BOOL   bMachine
);

Parameters

[in] hEvent

Handle to an event object. Use the CreateEvent function to create the event object.

[in] bMachine

Specifies the policy change type. If TRUE, computer policy changes are reported. If FALSE, user policy changes are reported.

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

Call the UnregisterGPNotification function to unregister the handle from receiving policy change notifications. Call the CloseHandle function to close the handle when it is no longer required.

An application can also receive notifications about policy changes when a WM_SETTINGCHANGE message is broadcast. In this instance, the wParam parameter value is 1 if computer policy was applied; it is zero if user policy was applied. The lParam parameter points to the string "Policy".

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header userenv.h
Library Userenv.lib
DLL Userenv.dll

See also

Group Policy Functions

Group Policy Overview

UnregisterGPNotification