SetUserObjectInformationA function (winuser.h)

Sets information about the specified window station or desktop object.


BOOL SetUserObjectInformationA(
  [in] HANDLE hObj,
  [in] int    nIndex,
  [in] PVOID  pvInfo,
  [in] DWORD  nLength


[in] hObj

A handle to the window station, desktop object or a current process pseudo handle. This handle can be returned by the CreateWindowStation, OpenWindowStation, CreateDesktop, OpenDesktop or GetCurrentProcess function.

[in] nIndex

The object information to be set. This parameter can be the following value.

Value Meaning
Sets the object's handle flags. The pvInfo parameter must point to a USEROBJECTFLAGS structure.
Sets the exception handling behavior when calling TimerProc. hObj must be the process handle returned by the GetCurrentProcess function.

The pvInfo parameter must point to a BOOL. If TRUE, Windows will enclose its calls to TimerProc with an exception handler that consumes and discards all exceptions. This has been the default behavior since Windows 2000, although that may change in future versions of Windows.

If pvInfo points to FALSE, Windows will not enclose its calls to TimerProc with an exception handler. A setting of FALSE is recommended. Otherwise, the application could behave unpredictably, and could be more vulnerable to security exploits.

[in] pvInfo

A pointer to a buffer containing the object information, or a BOOL.

[in] nLength

The size of the information contained in the buffer pointed to by pvInfo, in bytes.

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.



The winuser.h header defines SetUserObjectInformation as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See also







Window Station and Desktop Functions

Window Stations