Hi,

I have the spec to write an app where F10 is used as a key press. This is
due to the history of the DOS version and the want to keep the feel the
same.

The app is a CFormView derived app using VC 6

when F10 is pressed, I get the desired functionality but focus still gets
set to the menu. How can I prevent Focus from going to the menu after
processing?

The following is used to get to the accelerator table in oninit

 HINSTANCE hInst = AfxFindResourceHandle(MAKEINTRESOURCE(IDR_ACCELERATOR),
RT_ACCELERATOR);
 m_hAccelTable = ::LoadAccelerators(hInst,
MAKEINTRESOURCE(IDR_ACCELERATOR));

This is the same handle used in the pretransalatemessage below.

I have added the following to my code to process F10.
BOOL CStockUptakeView::PreTranslateMessage(MSG* pMsg)
{
 if (pMsg->message == WM_SYSKEYDOWN)
  {
  if (pMsg->wParam == VK_F10)
   {
   if (TranslateAccelerator (GetSafeHwnd( ), m_hAccelTable, pMsg))
    {
    return CFormView::PreTranslateMessage(pMsg);
    }
   }
  }

 if (pMsg->wParam == VK_RETURN)
  {
  if (TranslateAccelerator (GetSafeHwnd( ), m_hAccelTable, pMsg))
   {
   return CFormView::PreTranslateMessage(pMsg);
   }
  }

 return CFormView::PreTranslateMessage(pMsg);
}

Any assistance will be appreciated.
Hylton




Reply via email to