+ m_refData = new wxAcceleratorRefData;
+ pArr = (PACCELTABLE) new BYTE[nAccelLength];
+
+ for (i = 0; i < n; i++)
+ {
+ USHORT uVirt = AF_CHAR;
+
+ if (vaEntries[i].GetFlags() & wxACCEL_ALT)
+ {
+ uVirt |= AF_ALT;
+ uVirt |= AF_VIRTUALKEY;
+ }
+ if (vaEntries[i].GetFlags() & wxACCEL_SHIFT)
+ {
+ uVirt |= AF_SHIFT;
+ uVirt |= AF_VIRTUALKEY;
+ }
+ if (vaEntries[i].GetFlags() & wxACCEL_CTRL)
+ {
+ uVirt |= AF_CONTROL;
+ uVirt |= AF_VIRTUALKEY;
+ }
+
+ bool bIsVirtual;
+ USHORT uKey = wxCharCodeWXToOS2( vaEntries[i].GetKeyCode()
+ ,&bIsVirtual
+ );
+ if (bIsVirtual)
+ uVirt = AF_CHAR | AF_VIRTUALKEY;
+
+ USHORT uCmd = vaEntries[i].GetCommand();
+
+ pArr->aaccel[i].fs = uVirt;
+ pArr->aaccel[i].key = uKey;
+ pArr->aaccel[i].cmd = uCmd;
+ }
+ pArr->codepage = 437; // default to english Fix???
+ pArr->cAccel = (USHORT)n;
+ M_ACCELDATA->m_hAccel = ::WinCreateAccelTable( vHabmain
+ ,pArr
+ );
+ if (wxTheApp->GetTopWindow() != NULL)
+ {
+ //
+ // If we have accelerators the top window is the frame
+ //
+ wxFrame* pFrame = (wxFrame*)wxTheApp->GetTopWindow();
+
+ ::WinSetAccelTable( vHabmain
+ ,M_ACCELDATA->m_hAccel
+ ,(HWND)pFrame->GetHWND()
+ );
+ }
+
+ delete[] pArr;
+ M_ACCELDATA->m_ok = (M_ACCELDATA->m_hAccel != 0);
+} // end of wxAcceleratorTable::wxAcceleratorTable