网站首页  词典首页

请输入您要查询的函数:

 

术语 setforegroundwindow
释义 SetForegroundWindow
语法:
BOOL SetForegroundWindow( HWND hWnd
);
SetForegroundWindow函数
提出了SetForegroundWindow函数创建的线程进入前台指定窗口并激活窗口。键盘输入是针对窗口,各种视觉线索是用户改变。该系统分配一个优先稍高的线程创建的前台窗口而不是针对其他线程。
参数
hWnd
[in]句柄应该被激活,并提请前台窗口。
返回值
如果窗口被带到前台,则返回值为非零。
如果窗口不置于前台,返回值是零。
备注
Windows 98/Me的:系统限制哪些进程可以设置前台窗口。一个进程可以设置前台窗口下列条件只有一个是正确的:
该进程是前台进程。
这一进程开始了前台进程。
在程序中收到的最后一个输入事件。
没有前台进程。
前台进程正在调试。
前台没有锁定(见LockSetForegroundWindow)。
前台锁定超时已过期(见SystemParametersInfo SPI_GETFOREGROUNDLOCKTIMEOUT)。
视窗2000/XP的:没有菜单活跃。
这一变化,应用程序无法强迫窗口前台,而用户与另一个窗口工作。相反,前台和后台的Windows将激活窗口(见SetActiveWindow)和调用函数来通知用户。但是,在Microsoft Windows 98和Windows Millennium Edition(Windows Me)中,如果nonforeground线程调用SetForegroundWindow并传递处理的,这不是由调用线程创建的窗口,窗口不照在任务栏上。若要SetForegroundWindow行为是相同的,因为它没有在Windows 95和Microsoft Windows NT 4.0,改变前景锁定超时值时,应用程序安装。这可以从安装或与下面的函数调用安装应用程序:
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT,0,(LPVOID)0,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
这种方法允许在Windows 98/Windows Me和Windows 2000/Windows XP的SetForegroundWindow愿意以身作则,为所有的应用程序相同的Windows 95和Windows NT 4.0中,分别。安装应用程序要提醒,这是正在努力,使用户不被改变用户的行为感到惊讶。在Windows Windows 2000和Windows XP中,调用失败,除非调用线程可以改变前台窗口,所以必须从一个安装程序或修补程序应用程序调用。有关详细信息,请前台和后台的Windows。
一个进程,可以设置前台窗口可以使其他进程通过调用函数的AllowSetForegroundWindow前台窗口。由指定的进程dwProcessId无力设置前台窗口下一次用户生成的输入,除非输入是针对这一进程,或下一次进程调用AllowSetForegroundWindow,除非该进程是指定的。
前台进程可以禁用呼吁SetForegroundWindow通过调用LockSetForegroundWindow功能。
功能信息
最低DLL版本 user32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 3.1
UnicodeImplemented为Unicode版本。
参见
视窗概述,AllowSetForegroundWindow,FlashWindowEx,GetForegroundWindow,LockSetForegroundWindow,SetActiveWindow
==英文原文==SetForegroundWindow Function
The SetForegroundWindow function puts the thread that created the specified window into the foreground and activates the window. Keyboard input is directed to the window, and various visual cues are changed for the user. The system assigns a slightly higher priority to the thread that created the foreground window than it does to other threads.
Syntax
BOOL SetForegroundWindow( HWND hWnd
);
Parameters
hWnd
[in] Handle to the window that should be activated and brought to the foreground.
Return Value
If the window was brought to the foreground, the return value is nonzero.
If the window was not brought to the foreground, the return value is zero.
Remarks
Windows 98/Me: 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.
With this change, an application cannot force a window to the foreground while the user is working with another window. Instead, Foreground and Background Windows will activate the window (see SetActiveWindow ) and call the function to notify the user. However, on Microsoft Windows 98 and Windows Millennium Edition (Windows Me), if a nonforeground thread calls SetForegroundWindow and passes the handle of a window that was not created by the calling thread, the window is not flashed on the taskbar. To have SetForegroundWindow behave the same as it did on Windows 95 and Microsoft Windows NT 4.0, change the foreground lock timeout value when the application is installed. This can be done from the setup or installation application with the following function call:
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, (LPVOID)0, SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
This method allows SetForegroundWindow on Windows 98/Windows Me and Windows 2000/Windows XP to behave the same as Windows 95 and Windows NT 4.0, respectively, for all applications. The setup application should warn the user that this is being done so that the user isn't surprised by the changed behavior. On Windows Windows 2000 and Windows XP, the call fails unless the calling thread can change the foreground window, so this must be called from a setup or patch application. For more information, see Foreground and Background Windows.
A process that can set the foreground window can enable another process to set the foreground window by calling the AllowSetForegroundWindow function. The process specified by dwProcessId loses 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 calls AllowSetForegroundWindow, unless that process is specified.
The foreground process can disable calls to SetForegroundWindow by calling the LockSetForegroundWindow function.
Function Information
Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systemsWindows 95, Windows NT 3.1
UnicodeImplemented as Unicode version.
See Also
Windows Overview , AllowSetForegroundWindow , FlashWindowEx , GetForegroundWindow , LockSetForegroundWindow , SetActiveWindow
==原始网址==http://msdn.microsoft.com/en-us/library/ms633539(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:25:09