개발

VC6의 CHtmlView 버그

솜씨제이 2007. 9. 5. 11:07
VC6의 CHtmlView에는 버그가 있어서 텍스트 입력에서 Tab, Del, Enter 키등이 동작하지 않는다.
VC7이상의 CHtmlView에서는 버그가 수정되었는데 PreTranslateMessage()를 오버라이딩함으로 해결하였다. VC6에서 해당 버그를 수정하려면 CHtmlView를 상속해서 VC7의 CHtmlView::PreTranslateMessage()로 PreTranslateMessage()를 오버라이딩하면 된다.

BOOL CHtmlView::PreTranslateMessage(MSG* pMsg)
{
 ASSERT(pMsg != NULL);
 ASSERT_VALID(this);
 ASSERT(m_hWnd != NULL);
 // allow tooltip messages to be filtered (skip CFormView)
 if (CView::PreTranslateMessage(pMsg))
  return TRUE;
 // don't translate dialog messages when in Shift+F1 help mode
 CFrameWnd* pFrameWnd = GetTopLevelFrame();
 if (pFrameWnd != NULL && pFrameWnd->m_bHelpMode)
  return FALSE;
 // call all frame windows' PreTranslateMessage first
 pFrameWnd = GetParentFrame();   // start with first parent frame
 while (pFrameWnd != NULL)
 {
  // allow owner & frames to translate
  if (pFrameWnd->PreTranslateMessage(pMsg))
   return TRUE;
  // try parent frames until there are no parent frames
  pFrameWnd = pFrameWnd->GetParentFrame();
 }
 // check if the browser control wants to handle the message
 BOOL bRet = FALSE;
 if(m_pBrowserApp != NULL)
 {
  CComQIPtr<IOleInPlaceActiveObject> spInPlace = m_pBrowserApp;
  if (spInPlace)
   bRet = (spInPlace->TranslateAccelerator(pMsg) == S_OK) ? TRUE : FALSE;
 }
 return bRet;
}