网站首页  词典首页

请输入您要查询的函数:

 

术语 translateaccelerator
释义 TranslateAccelerator
语法:
int TranslateAccelerator( HWND hWnd,
HACCEL hAccTable,
LPMSG lpMsg
);
TranslateAccelerator函数
该TranslateAccelerator函数处理的菜单命令快捷键。函数转换一WM_KEYDOWN或WM_SYSKEYDOWN消息一个WM_COMMAND或WM_SYSCOMMAND的消息(如果有一个为在指定的加速表键项),然后发送到WM_COMMAND或WM_SYSCOMMAND的消息,直接到指定的窗口过程。 TranslateAccelerator不会返回,直到窗口程序处理的信息。
参数
hWnd
[in]句柄窗口的消息将被翻译。
hAccTable
[in]句柄加速表。加速器表必须由被加载到LoadAccelerators函数调用一个函数的CreateAcceleratorTable创建或调用。
lpMsg
[in]指向一个MSG结构,它包含的信息资料调用线程的消息队列使用GetMessage或PeekMessage检索功能。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
为了区别的信息,这一职能由菜单或控制,高的到WM_COMMAND或WM_SYSCOMMAND的消息wParam参数顺序单词发送的邮件发送包含值1。
快捷键组合使用选择窗口菜单项翻译成WM_SYSCOMMAND的消息,所有其他的快捷键组合成WM_COMMAND消息翻译。
When TranslateAccelerator returns a nonzero value and the message is translated, the application should not use the TranslateMessage function to process the message again.
加速器不需要对应菜单命令。
如果加速器命令对应一个菜单项,应用程序发送WM_INITMENU和WM_INITMENUPOPUP消息消息,因为如果用户试图显示菜单。然而,这些邮件没有发送如果存在下列条件之一:
窗口被禁用。
快捷键组合不符合的项目窗口菜单和窗口最小化。
鼠标捕获将发挥作用。有关鼠标捕获,看到SetCapture函数的信息。
如果指定的窗口是活动窗口,没有窗口具有键盘焦点(这通常是如果窗口是最小化的情况下),TranslateAccelerator转换WM_SYSKEYUP,而非WM_KEYUP和WM_KEYDOWN消息WM_SYSKEYDOWN消息。
如果发生加速器按键对应一个菜单项时,拥有的窗口最小化的菜单,TranslateAccelerator不会发送WM_COMMAND消息。但是,如果加速器击键会出现不匹配,在窗口的菜单项或窗口菜单中的任何函数发送一个WM_COMMAND消息,即使窗口最小化。
有关示例,请参阅创建字体属性加速器。
功能信息
最低DLL版本 user32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 3.1
UnicodeImplemented为ANSI和Unicode版本。
参见
键盘加速器,CreateAcceleratorTable,GetMessage,LoadAccelerators,味精,PeekMessage,SetCapture,TranslateMessage,WM_COMMAND消息,WM_INITMENU,WM_INITMENUPOPUP消息,WM_KEYDOWN,WM_SYSKEYDOWN,WM_SYSCOMMAND的
==英文原文==TranslateAccelerator Function
The TranslateAccelerator function processes accelerator keys for menu commands. The function translates a WM_KEYDOWN or WM_SYSKEYDOWN message to a WM_COMMAND or WM_SYSCOMMAND message (if there is an entry for the key in the specified accelerator table) and then sends the WM_COMMAND or WM_SYSCOMMAND message directly to the specified window procedure. TranslateAccelerator does not return until the window procedure has processed the message.
Syntax
int TranslateAccelerator( HWND hWnd,
HACCEL hAccTable,
LPMSG lpMsg
);
Parameters
hWnd
[in] Handle to the window whose messages are to be translated.
hAccTable
[in] Handle to the accelerator table. The accelerator table must have been loaded by a call to the LoadAccelerators function or created by a call to the CreateAcceleratorTable function.
lpMsg
[in] Pointer to an MSG structure that contains message information retrieved from the calling thread's message queue using the GetMessage or PeekMessage function.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
Remarks
To differentiate the message that this function sends from messages sent by menus or controls, the high-order word of the wParam parameter of the WM_COMMAND or WM_SYSCOMMAND message contains the value 1.
Accelerator key combinations used to select items from the window menu are translated into WM_SYSCOMMAND messages; all other accelerator key combinations are translated into WM_COMMAND messages.
When TranslateAccelerator returns a nonzero value and the message is translated, the application should not use the TranslateMessage function to process the message again.
An accelerator need not correspond to a menu command.
If the accelerator command corresponds to a menu item, the application is sent WM_INITMENU and WM_INITMENUPOPUP messages, as if the user were trying to display the menu. However, these messages are not sent if any of the following conditions exist:
The window is disabled.
The accelerator key combination does not correspond to an item on the window menu and the window is minimized.
A mouse capture is in effect. For information about mouse capture, see the SetCapture function.
If the specified window is the active window and no window has the keyboard focus (which is generally the case if the window is minimized), TranslateAccelerator translates WM_SYSKEYUP and WM_SYSKEYDOWN messages instead of WM_KEYUP and WM_KEYDOWN messages.
If an accelerator keystroke occurs that corresponds to a menu item when the window that owns the menu is minimized, TranslateAccelerator does not send a WM_COMMAND message. However, if an accelerator keystroke occurs that does not match any of the items in the window's menu or in the window menu, the function sends a WM_COMMAND message, even if the window is minimized.
For an example, see Creating Accelerators for Font Attributes .
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 ANSI and Unicode versions.
See Also
Keyboard Accelerators , CreateAcceleratorTable , GetMessage , LoadAccelerators , MSG , PeekMessage , SetCapture , TranslateMessage , WM_COMMAND , WM_INITMENU , WM_INITMENUPOPUP , WM_KEYDOWN , WM_SYSKEYDOWN , WM_SYSCOMMAND
==原始网址==http://msdn.microsoft.com/en-us/library/ms646373(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:20:15