PRB: TranslateAccelerator() Not Called for ActiveX Controls (183167)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 4.1
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Visual C++ .NET (2003)
- Microsoft Visual C++ .NET (2002)
This article was previously published under Q183167 SYMPTOMS An ActiveX control can process keyboard messages in the
IOleInPlaceActiveObject::TranslateAccelerator() function. If the ActiveX
control is created dynamically in a CView class or a CPropertyPage class,
TranslateAccelerator() will not be called. CAUSE The CView and CPropertyPage classes are not designed to
host ActiveX controls, therefore they do not call the TranslateAccelerator()
function. RESOLUTION Override the PreTranslateMessage() function and call the
PreTranslateInput() function. This results in a call to the
COccManager::IsDialogMessage() function, which calls the control's
IOleInPlaceActiveObject::TranslateAccelerator() function. The
following sample code shows how to override PreTranslateMessage() in a
CView-derived class called CTestView: Sample Code
BOOL CTestView::PreTranslateMessage(MSG* pMsg)
{
CView::PreTranslateMessage(pMsg);
return PreTranslateInput (pMsg);
}
STATUS This behavior is by design.
Modification Type: | Major | Last Reviewed: | 9/22/2003 |
---|
Keywords: | kbprb KB183167 |
---|
|