网站首页  词典首页

请输入您要查询的函数:

 

术语 setfocus
释义 SetFocus
语法:
HWND SetFocus( HWND hWnd
);
SetFocus函数
SetFocus函数键盘焦点设置到指定的窗口。窗口要重视调用线程的消息队列。
参数
hWnd
[in]的窗口句柄将接收键盘输入。如果该参数为NULL,按键被忽略。
返回值
如果函数成功,返回值是窗口句柄以前具有键盘焦点。如果hWnd参数是无效的或窗口没有连接到调用线程的消息队列,返回值为NULL。为了获得更多错误信息,调用GetLastError。
备注
SetFocus函数WM_KILLFOCUS消息发送给窗口失去键盘焦点和WM_SETFOCUS消息的窗口接收键盘焦点。它还可以激活的窗口或接收到焦点的窗口接收到焦点的父母。
如果一个窗口处于活动状态,但没有焦点,按下将产生WM_SYSCHAR,WM_SYSKEYDOWN或WM_SYSKEYUP消息的关键。如果VK_MENU的关键,也是按下时,该邮件的lParam参数将有位30集。否则,生产不会出现此位集的消息。
通过使用AttachThreadInput函数,一个线程可以处理附加的投入到另一个线程。这使得一个线程调用设置焦点设置键盘焦点连接到另一个线程的消息队列一个窗口。
有关示例,请参阅初始化一个对话框。
功能信息
最低DLL版本 user32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 3.1
参见
键盘输入,AttachThreadInput,GetFocus,WM_KILLFOCUS,WM_SETFOCUS,WM_SYSCHAR,WM_SYSKEYDOWN,WM_SYSKEYUP
==英文原文==SetFocus Function
The SetFocus function sets the keyboard focus to the specified window. The window must be attached to the calling thread's message queue.
Syntax
HWND SetFocus( HWND hWnd
);
Parameters
hWnd
[in] Handle to the window that will receive the keyboard input. If this parameter is NULL, keystrokes are ignored.
Return Value
If the function succeeds, the return value is the handle to the window that previously had the keyboard focus. If the hWnd parameter is invalid or the window is not attached to the calling thread's message queue, the return value is NULL. To get extended error information, call GetLastError .
Remarks
The SetFocus function sends a WM_KILLFOCUS message to the window that loses the keyboard focus and a WM_SETFOCUS message to the window that receives the keyboard focus. It also activates either the window that receives the focus or the parent of the window that receives the focus.
If a window is active but does not have the focus, any key pressed will produce the WM_SYSCHAR , WM_SYSKEYDOWN , or WM_SYSKEYUP message. If the VK_MENU key is also pressed, the lParam parameter of the message will have bit 30 set. Otherwise, the messages produced do not have this bit set.
By using the AttachThreadInput function, a thread can attach its input processing to another thread. This allows a thread to call SetFocus to set the keyboard focus to a window attached to another thread's message queue.
For an example, see Initializing a Dialog Box .
Function Information
Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systemsWindows 95, Windows NT 3.1
See Also
Keyboard Input , AttachThreadInput , GetFocus , WM_KILLFOCUS , WM_SETFOCUS , WM_SYSCHAR , WM_SYSKEYDOWN , WM_SYSKEYUP
==原始网址==http://msdn.microsoft.com/en-us/library/ms646312(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:17