GetProcessWindowStation

Retrieves a handle to the window station for the current process.

Summary

The GetProcessWindowStation function retrieves a handle to the window station associated with the calling process.

A window station is a protected object that contains the system's desktop objects, such as desktops,álogo boxes, and global atoms.

Syntax


HWINSTA GetProcessWindowStation();
                    

Parameters

This function takes no parameters.

Return Value

If the function succeeds, the return value is a handle to the window station for the current process. If the function fails, the return value is NULL.

To get extended error information, call GetLastError.

Remarks

The handle returned by GetProcessWindowStation is associated with the window station of the calling process.

You must call CloseHandle to close the handle when you are finished with it.

Security Information:

A window station is a secure object. The calling process must have appropriate permissions to access the window station.

Typically, applications do not need to call GetProcessWindowStation. The system manages window stations for user sessions. However, some advanced scenarios, such as inter-process communication or impersonation, might require direct interaction with window stations.

See Also