1 out of 4 rated this helpful - Rate this topic

OpenInputDesktop function

Applies to: desktop apps only

Opens the desktop that receives user input.

Syntax

HDESK WINAPI OpenInputDesktop(
  __in  DWORD dwFlags,
  __in  BOOL fInherit,
  __in  ACCESS_MASK dwDesiredAccess
);

Parameters

dwFlags [in]

This parameter can be zero or the following value.

ValueMeaning
DF_ALLOWOTHERACCOUNTHOOK
0x0001

Allows processes running in other accounts on the desktop to set hooks in this process.

 

fInherit [in]

If this value is TRUE, processes created by this process will inherit the handle. Otherwise, the processes do not inherit this handle.

dwDesiredAccess [in]

The access to the desktop. For a list of access rights, see Desktop Security and Access Rights.

Return value

If the function succeeds, the return value is a handle to the desktop that receives user input. When you are finished using the handle, call the CloseDesktop function to close it.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

Remarks

The calling process must have an associated window station, either assigned by the system when the process is created, or set by the SetProcessWindowStation function. The window station associated with the calling process must be capable of receiving input.

If the calling process is running in a disconnected session, the function returns a handle to the desktop that becomes active when the user restores the connection.

An application can use the SwitchDesktop function to change the input desktop.

If the dwDesiredAccess parameter specifies the READ_CONTROL, WRITE_DAC, or WRITE_OWNER standard access rights, you must also request the DESKTOP_READOBJECTS and DESKTOP_WRITEOBJECTS access rights.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

CloseDesktop
Desktops
SetProcessWindowStation
SwitchDesktop
Window Station and Desktop Functions

 

 

Send comments about this topic to Microsoft

Build date: 2/3/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
You can get the desktop but which desktop is it?
How do you get the name of the desktop you just opened? $0$0 $0 $0Edit KB: Use GetUserObjectInformations with UOI_NAME. PS. It's not a place for asking questions.$0