O'Reilly logo

C++ Windows Programming by Stefan Björnander

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Accelerator class

It is possible to add an accelerator to a menu item. The accelerator text is preceded by a tabulator character (\t) and the text is made up of the optional prefixes Ctrl+, Shift+, or Alt+ followed by a character (for instance, &Open\tCtrl+O) or the name of a virtual key (for instance, &Save\tAlt+F2).

Accelerator.h

namespace SmallWindows { 

The Win32 API holds a set of virtual keys with names beginning with VK_. In Small Windows, they have been given other names, hopefully easier to understand. The virtual keys available are: F1 - F12, Insert, Delete, Backspace, Tab, Home, End, Page Up, Page Down, Left, Right, Up, Down, Space, Escape, and Return:

 enum Keys {KeyF1 = VK_F1, KeyF2 = VK_F2, KeyF3 = VK_F3, KeyF4 = VK_F4, KeyF5 = ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required