AllowSetForegroundWindow

王朝百科·作者佚名  2010-07-15  
宽屏版  字体: |||超大  

TheAllowSetForegroundWindowfunction enables the specified process to set the foreground window using the SetForegroundWindow function. The calling process must already be able to set the foreground window. For more information, see Remarks later in this topic.

Syntax

BOOL AllowSetForegroundWindow(

DWORDdwProcessId);Parameters

dwProcessId[in] Specifies the identifier of the process that will be enabled to set the foreground window. If this parameter is ASFW_ANY, all processes will be enabled to set the foreground window. Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. The function will fail if the calling process cannot set the foreground window. To get extended error information, call GetLastError.

Remarks

Starting with Microsoft Windows 98 and Windows 2000, the system restricts which processes can set the foreground window. A process can set the foreground window only if one of the following conditions is true:

The process is the foreground process. The process was started by the foreground process. The process received the last input event. There is no foreground process. The foreground process is being debugged. The foreground is not locked (see LockSetForegroundWindow). The foreground lock time-out has expired (see SPI_GETFOREGROUNDLOCKTIMEOUT in SystemParametersInfo).Windows 2000/XP:No menus are active.

A process that can set the foreground window can enable another process to set the foreground window by callingAllowSetForegroundWindow. The process specified bydwProcessIdloses the ability to set the foreground window the next time the user generates input, unless the input is directed at that process, or the next time a process callsAllowSetForegroundWindow, unless that process is specified.

Windows 95/98/Me:This function is not implemented. Therefore, processes must cooperate to manage the foreground window. For example, an application may wish to support only one instance. When the second instance starts up, it should detect the previous instance and callSetForegroundWindowon the window of the previous instance. It should not post a message to the window of the previous instance asking it to callSetForegroundWindowon itself, because the previous instance will not necessarily have permission to callSetForegroundWindow.

Function Information

Minimum DLL Version

user32.dll

Header

Declared in Winuser.h, include Windows.h

Import library

User32.lib

Minimum operating systems

Windows Me, Windows 2000

See Also

Windows Overview, LockSetForegroundWindow, SetForegroundWindow

 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝百科 版权所有