Colt
November 6th, 2000, 10:00 AM
I have problems implementing accelerators for an inplace activated Active Doc. Server.
To reproduce the error:
Create an Active Document Server with the App. Wizard. Select a view based on CFormView. After generation add some push buttons with accelerators to the CFormView. Add some default handlers to the buttons. Start application standalone and test accelerators. (It should work).
Start the application embedded in an Active Document Container (e.g. Office Binder) => The accelerators won't work.
This problem is very urgent for me. The problem seems to be in the following code of the MFC:
BOOL COleIPFrameWnd::PreTranslateMessage(MSG* pMsg)
{
// check server's accelerators first
if (CFrameWnd::PreTranslateMessage(pMsg))
return TRUE;
if (pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST)
{
// always check to see if they exist in the default accel table
// (they may exist but not be translated when disabled)
HACCEL hAccel = GetDefaultAccelerator();
if (hAccel != NULL && IsAccelerator(hAccel,
CopyAcceleratorTable(hAccel, NULL, 0), pMsg, NULL))
{
return TRUE;
}
// check container's accelerators as last chance
OLEINPLACEFRAMEINFO frameInfo = m_frameInfo;
if (::OleTranslateAccelerator(m_lpFrame, &frameInfo, pMsg) == S_OK)
return TRUE;
}
return FALSE; // keystroke not processed.
}
::OleTranslateAccelerator() always returns S_OK, so that the CFormView gets no chance to translate the accelerator.
Has anybody out there an idea?
Thanx for any hint
To reproduce the error:
Create an Active Document Server with the App. Wizard. Select a view based on CFormView. After generation add some push buttons with accelerators to the CFormView. Add some default handlers to the buttons. Start application standalone and test accelerators. (It should work).
Start the application embedded in an Active Document Container (e.g. Office Binder) => The accelerators won't work.
This problem is very urgent for me. The problem seems to be in the following code of the MFC:
BOOL COleIPFrameWnd::PreTranslateMessage(MSG* pMsg)
{
// check server's accelerators first
if (CFrameWnd::PreTranslateMessage(pMsg))
return TRUE;
if (pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST)
{
// always check to see if they exist in the default accel table
// (they may exist but not be translated when disabled)
HACCEL hAccel = GetDefaultAccelerator();
if (hAccel != NULL && IsAccelerator(hAccel,
CopyAcceleratorTable(hAccel, NULL, 0), pMsg, NULL))
{
return TRUE;
}
// check container's accelerators as last chance
OLEINPLACEFRAMEINFO frameInfo = m_frameInfo;
if (::OleTranslateAccelerator(m_lpFrame, &frameInfo, pMsg) == S_OK)
return TRUE;
}
return FALSE; // keystroke not processed.
}
::OleTranslateAccelerator() always returns S_OK, so that the CFormView gets no chance to translate the accelerator.
Has anybody out there an idea?
Thanx for any hint