WinXAddAccelerator


WinXAddAccelerator (ACCEL accel[], cmd, key, control, alt, shift)

Adds a keyboard accelerator to an accelerator array

Parameter Description
ACCEL accel[] The array to add the accelerator to
cmd The command the accelerator will trigger
key The VK code of the base key of this accelerator. For standard alphanumeric keys just use a char constant
control $$TRUE to enable the Control modifier
alt $$TRUE to enable the Alt modifer
shift $$TRUE to enable the Shift modifier

Returns

$$TRUE on success or $$FALSE on fail

Remarks

accel[] is an array of ACCEL structures. You do not need to initialise this array before calling WinXAddAccelerator. You can convert the ACCEL array into an accelerator table with the CreateAcceleratorTableA Win32API function. Note that assuming the ACCEL array starts with no elements; it will contain 1 element for every accelerator you added with this function. To use the accelerators, pass the accelerator tabled generated by the CreateAcceleratorTableA function into the WinXDoEvents function. Whenever the user presses the appropriate key combination, the onCommand callback is invoked with the id parameter set the the cmd of the accelerator.

Examples

ACCEL accel[]

...

' Create an accelerator table
' F1
WinXAddAccelerator (@accel[], $$CMD_HELP, $$VK_F1, $$FALSE, $$FALSE, $$FALSE)
' Ctrl+S
WinXAddAccelerator (@accel[], $$CMD_SAVE, 'S', $$TRUE, $$FALSE, $$FALSE)

hAccelerators = CreateAcceleratorTableA (&accel[], UBOUND(accel[])+1)

Related Links

WinXDoEvents