본문 바로가기
kxLibrary

KFCApp Class Updated

by 두루물 2012. 4. 11.

Purpose:

메인 프레임,MDI 차일드 창의 핫키 이벤트를 다른 모달리스 다이얼로그,바에서 가로채는 현상 bugfix.

Added Code:

//2012.04.11 krkim 다이얼로그바에서의 메인프레임 핫키되게
if(m_pMainWnd && m_pMainWnd->PreTranslateMessage(pMsg) == TRUE)
      return TRUE;

BOOL KFCApp::PreTranslateMessage(MSG* pMsg)/* This called from KFCApp directly*/
{
	//HWND hAncestor = GetAncestor(pMsg->hwnd,GA_ROOT);
	// check for cheap CS_IME style first... windows7 runtime error - IME window enter here,so  avoid the IME window
	if (GetClassLong(pMsg->hwnd, GCL_STYLE) & CS_IME)
		return FALSE;

	/*If KFCWnd is Main Window which has not m_hAccel member,you can the m_hAccel set Here*/
	if(m_hAccel != NULL && ::TranslateAccelerator(pMsg->hwnd, m_hAccel, pMsg))
		return TRUE;
#if 0
	if(m_pMainWnd)
		return m_pMainWnd->PreTranslateMessage(pMsg);
#else
	//2012.04.11 krkim 다이얼로그바에서의 메인프레임 핫키되게
	if(m_pMainWnd && m_pMainWnd->PreTranslateMessage(pMsg) == TRUE)
		return TRUE;

	HWND hWndStop = NULL;
	if(m_pMainWnd && m_pMainWnd->IsWindow())
		hWndStop = m_pMainWnd->GetSafeHwnd();
	else
		hWndStop = GetAncestor(pMsg->hwnd,GA_ROOT);

	for (HWND hWnd = pMsg->hwnd; hWnd != NULL; hWnd = ::GetParent(hWnd))
	{
		KFCWnd* pWnd = KFCWnd::GetPointer(hWnd);
		if (pWnd != NULL)
		{
			// target window is a C++ window
			if (pWnd->PreTranslateMessage(pMsg))
				return TRUE; // trapped by target window (eg: accelerators)
		}

		// got to hWndStop window without interest
		if (hWnd == hWndStop)
			break;
	}
#endif
	return FALSE;       // no special processing
}

Download New Updated Class(Full Source Code):


KFCApp.cpp


'kxLibrary' 카테고리의 다른 글

KFCScrollBar Class Update  (0) 2012.04.24
kxLibrary Class Diagram  (0) 2012.04.11
kxBuffLib::kxFile Class Source Code  (0) 2011.10.06
KFC1.0 Class Update For KFCScrollBar  (0) 2011.05.05
KFC1.0 Class Update For KFCBitmap  (0) 2011.05.05