WinCreateAtomTable
Appearance
This function creates an accelerator table from the accelerator definitions in memory.
Syntax
WinCreateAccelTable(hab, pacctAccelTable)
Parameters
- hab (HAB) - input
- Anchor-block handle.
- pacctAccelTable (PACCELTABLE) - input
- Accelerator table.
Returns
- haccelhAccel (HACCEL) - returns
- Accelerator-table handle.
Remarks
This function returns a different haccelhAccel value when called twice in succession with the same parameter values.
Example Code
This example creates an accelerator-table handle for an in memory accelerator table consisting of 3 accelerator keys, using US codepage 437.
#define INCL_WINACCELERATORS /* Window Accelerator Functions */
#define INCL_WININPUT /* Key constants */
#define INCL_WINFRAMEMGR /* Frame control constants */
#include <os2.h>
ULONG ulAccelLen = 0; /* Accelerator-table length */
HACCEL hAccel = NULLHANDLE; /* Accelerator-table handle */
PACCELTABLE pacctAccelTable = NULL; /* Pointer to Accelerator-tab le */
HAB hab = NULLHANDLE; /* Anchor block handle */
ACCEL acctable[] = {
AF_SYSCOMMAND | AF_ALT | AF_VIRTUALKEY,VK_F7,SC_MOVE,
AF_SYSCOMMAND | AF_ALT | AF_VIRTUALKEY,VK_F8,SC_SIZE,
AF_SYSCOMMAND | AF_ALT | AF_VIRTUALKEY,VK_F12,SC_CLOSE};
/* Get memory for the Accelerator-table and initialize it. */
ulAccelLen = sizeof( acctable ) + sizeof( ACCELTABLE );
pacctAccelTable = (PACCELTABLE) malloc ( ulAccelLen );
pacctAccelTable->cAccel = 3; /* Number of ACCEL entries */
pacctAccelTable->codepage = 437; /* Code page */
pacctAccelTable->aaccel[0] = acctable[0]; /* ACCEL entries... */
pacctAccelTable->aaccel[1] = acctable[1];
pacctAccelTable->aaccel[2] = acctable[2];
hAccel = WinCreateAccelTable( hab, pacctAccelTable );
Definition
#define INCL_WINACCELERATORS /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HAB hab; /* Anchor-block handle. */ PACCELTABLE pacctAccelTable; /* Accelerator table. */ HACCEL haccelhAccel; /* Accelerator-table handle. */ haccelhAccel = WinCreateAccelTable(hab, pacctAccelTable);
Related Functions
- WinCopyAccelTable
- WinDestroyAccelTable
- WinLoadAccelTable
- WinQueryAccelTable
- WinSetAccelTable
- WinTranslateAccel