[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
BOOL pascal TranslateAccelerator(LPMSG msg)

  This function attempts to translate keystrokes into an accelerator.
TranslateAccelerator() will only attempt to translate events whose
message field is WM_CHAR. The translation process proceeds as follows:

  1) If the user pressed an ALT key combination, we see if there is a
   menu associated with the window which has the input focus (or
   associated with one the window's ancestors). If the key corresponds to
   a menubar item, the msg structure will be filled with :
  message - WM_COMMAND
  wParam  - the id corresponding to that keystroke
  lParam  - the LOWORD will contain the handle of the menubar

  2) If the application has defined an accelerator table, the
   currently defined accelerator table is searched for an entry which
   contains the passed keystroke, and if an entry was found, the msg
   structure will be filled with :
  message - WM_COMMAND
  wParam  - the id corresponding to that keystroke
  lParam  - the LOWORD will contain the handle of the global variable
   AcceleratorWnd

  3) If the ALT key combination which was pressed did not correspond
   to a menu item, and was not an accelerator, then a WM_MENUCHAR
   message is sent to the window which owns the menubar. The
   application, upon receipt of the WM_MENUCHAR message, can choose to
   take some kind of action to warn the user that he has pressed an
   invalid key combination.

  In the application's main message loop, DispatchMessage() will route
the WM_COMMAND msg to the appropriate window. You must call
TranslateAccelerator() from within your main message loop in order to
enable ALT key combinations to invoke menubar items.

Parameters
  msg is a pointer to an MSG structure.

Returns
  TRUE if the msg was translated into an accelerator, FALSE if not.

Example

  This is the main MEWEL message loop...

MSG msg;

while (GetMessage(&msg) != WM_QUIT)
  TranslateAccelerator(&msg);
  DispatchMessage(&msg);

.

This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson