void COXScrollTip::RedrawBackground(CRect rect)
	// --- In  :
	// --- Out : 
	// --- Returns :
	// --- Effect : Updates the windows that are covered by the specified rect (screen coordinates)
	{
	// We give the windows that are under the top left and bottom right corner of 
	// the specified rect the opportunity the redraw themselves now.
	// Other areas will be repainted through a (posted) WM_PAINT, which will
	// be handled later.
	if (!rect.IsRectEmpty())
		{
		CWnd* pBackTopLeftWnd = CWnd::WindowFromPoint(rect.TopLeft());
		if (pBackTopLeftWnd != NULL)
			{
			pBackTopLeftWnd = pBackTopLeftWnd->GetTopLevelParent();
			ASSERT(pBackTopLeftWnd != NULL);
			pBackTopLeftWnd->RedrawWindow(&rect);
			}
		CWnd* pBackBottomRightWnd = CWnd::WindowFromPoint(rect.BottomRight());
		if ((pBackBottomRightWnd != NULL) && (pBackTopLeftWnd != pBackBottomRightWnd))
			{
			pBackBottomRightWnd = pBackBottomRightWnd->GetTopLevelParent();
			ASSERT(pBackBottomRightWnd != NULL);
			pBackBottomRightWnd->RedrawWindow(&rect);
			}
		}
	}
예제 #2
0
파일: win-thread.cpp 프로젝트: sirmax1/coin
BOOL AfxInternalPreTranslateMessage(MSG* pMsg)
{
	//	ASSERT_VALID(this);

	CWinThread *pThread = AfxGetThread();
	if( pThread )
	{
		// if this is a thread-message, short-circuit this function
		if (pMsg->hwnd == NULL && pThread->DispatchThreadMessageEx(*pMsg))
			return TRUE;
	}

	// walk from target to main window
	CWnd* pMainWnd = AfxGetMainWnd();
	if (CWnd::WalkPreTranslateTree(pMainWnd->GetSafeHwnd(), pMsg))
		return TRUE;

	// in case of modeless dialogs, last chance route through main
	//   window's accelerator table
	if (pMainWnd != NULL)
	{
		CWnd* pWnd = CWnd::FromHandle(pMsg->hwnd);
		if (pWnd->GetTopLevelParent() != pMainWnd)
			return pMainWnd->PreTranslateMessage(pMsg);
	}

	return FALSE;   // no special processing
}
예제 #3
0
파일: Malayalam.cpp 프로젝트: vchacko/mmki
BOOL isMalayalam()
{
	if(GetKeyState(VK_SCROLL)&1)
	{
		CWnd * window = CWnd::FromHandle(msg->hwnd);
		
		window = window->GetTopLevelParent();
		CString s;
		window->GetWindowText(s);
		
		if(s.Find("Microsoft Word")>-1)
		{
			preback = FALSE;
			return true;
		}
		else if(s.Find("Paint")>-1)
		{
			paint = TRUE;
			return true;
		}
		else 
		{ 
			
			preback = TRUE;
			return true;
		}
		return true;
	}
	return false;
}
예제 #4
0
파일: winfrmx.cpp 프로젝트: Rupan/winscp
HWND CFrameWnd::SetHelpCapture(POINT point, BOOL* pbDescendant)
	// set or release capture, depending on where the mouse is
	// also assign the proper cursor to be displayed.
{
	if (!m_bHelpMode)
		return NULL;

	HWND hWndCapture = ::GetCapture();
	CWnd* pWndHit = WindowFromPoint(point);
	HWND hWndHit = pWndHit->GetSafeHwnd();
	CWnd* pTopHit = pWndHit->GetTopLevelParent();
	CWnd* pTopActive = GetActiveWindow()->GetTopLevelParent();
	BOOL bDescendant = FALSE;
	HTASK hCurTask = (HTASK)GetCurrentThreadId();
	HTASK hTaskHit = hWndHit != NULL ? ::GetWindowTask(hWndHit) : NULL;

	if (pTopActive == NULL || hWndHit == ::GetDesktopWindow())
	{
		if (hWndCapture == m_hWnd)
			ReleaseCapture();
		SetCursor(afxData.hcurArrow);
	}
	else if (pTopActive == NULL ||
		hWndHit == NULL || hCurTask != hTaskHit ||
		!AfxIsDescendant(m_hWnd, hWndHit))
	{
		if (hCurTask != hTaskHit)
			hWndHit = NULL;
		if (hWndCapture == m_hWnd)
			ReleaseCapture();
	}
	else
	{
		bDescendant = TRUE;
		if (pTopActive != pTopHit)
			hWndHit = NULL;
		else
		{
			if (hWndCapture != m_hWnd)
				::SetCapture(m_hWnd);
			SetCursor(afxData.hcurHelp);
		}
	}
	if (pbDescendant != NULL)
		*pbDescendant = bDescendant;
	return hWndHit;
}
예제 #5
0
파일: win-thread.cpp 프로젝트: sirmax1/coin
bool CWinThread::PreTranslateMessage(MSG& msg) {
	// if this is a thread-message, short-circuit this function
	if (msg.hwnd == NULL && DispatchThreadMessageEx(msg))
		return true;
	// walk from target to main window
	CWnd *pMainWnd = AfxGetMainWnd();
	if (CWnd::WalkPreTranslateTree(pMainWnd->GetSafeHwnd(), &msg))
		return true;
	// in case of modeless dialogs, last chance route through main
	//   window's accelerator table
	if (pMainWnd != NULL)
	{
		CWnd* pWnd = CWnd::FromHandle(msg.hwnd);
		if (pWnd->GetTopLevelParent() != pMainWnd)
			return pMainWnd->PreTranslateMessage(&msg);
	}
	return false;
}
예제 #6
0
BOOL InformApp::PreTranslateMessage(MSG* pMsg)
{
  if ((pMsg->hwnd == NULL) && DispatchThreadMessageEx(pMsg))
    return TRUE;

  CArray<CFrameWnd*> frames;
  GetWindowFrames(frames);

  CWnd* wnd = CWnd::FromHandle(pMsg->hwnd);
  for (int i = 0; i < frames.GetSize(); i++)
  {
    CFrameWnd* frame = frames[i];
    if (wnd->GetTopLevelParent() == frame)
      return CWnd::WalkPreTranslateTree(frame->GetSafeHwnd(),pMsg);
  }

  CWnd* mainWnd = AfxGetMainWnd();
  if (mainWnd != NULL)
    return mainWnd->PreTranslateMessage(pMsg);
  return FALSE;
}
예제 #7
0
int CControlBar::HitTestToolTip(CPoint point, UINT* pHit)
{
	if (pHit != NULL)
		*pHit = (UINT)-1;   // assume it won't hit anything

	// make sure this app is active
	if (!IsTopParentActive())
		return HITTYPE_INACTIVE;

	// make sure the toolbar itself is active
	CWnd* pParent = GetTopLevelParent();
	if (!pParent->IsWindowEnabled())
		return HITTYPE_DISABLED;

	// check for this application tracking (capture set)
	CWnd* pCapture = GetCapture();
	CWnd* pCaptureParent = pCapture->GetTopLevelParent();
	if (pCaptureParent == pParent)
		return HITTYPE_TRACKING;

	// check for the bar having focus
	HWND hWnd = ::GetFocus();
	if (hWnd != NULL && (hWnd == m_hWnd || ::IsChild(m_hWnd, hWnd)))
		return HITTYPE_FOCUS;

	// see if the mouse point is actually in the control bar window
	hWnd = ::WindowFromPoint(point);
	if (hWnd == NULL || (hWnd != m_hWnd && !::IsChild(m_hWnd, hWnd)))
		return HITTYPE_OUTSIDE;

	// finally do the hit test on the items within the control bar
	ScreenToClient(&point);
	UINT nHit = OnCmdHitTest(point, NULL);
	if (pHit != NULL)
		*pHit = nHit;
	return nHit != (UINT)-1 ? HITTYPE_SUCCESS : HITTYPE_NOTHING;
}
예제 #8
0
파일: olecli2.cpp 프로젝트: anyue100/winscp
void COleClientItem::OnDeactivateUI(BOOL /*bUndoable*/)
{
	ASSERT_VALID(this);

	// notify the item of the state change
	if (m_nItemState != activeState)
	{
		OnChange(OLE_CHANGED_STATE, (DWORD)activeState);
		m_nItemState = activeState;
	}

	if (m_pView != NULL && m_pDocument->GetFirstViewPosition())
	{
		// restore container window's WS_CLIPCHILDREN bit...
		ASSERT_VALID(m_pView);
		m_pView->ModifyStyle(WS_CLIPCHILDREN, m_dwContainerStyle & WS_CLIPCHILDREN);
	}

	// restore original user interface on the frame window
	CFrameWnd* pMainFrame;
	CFrameWnd* pDocFrame = NULL;
	if (OnGetWindowContext(&pMainFrame, &pDocFrame, NULL))
	{
		ASSERT_VALID(pMainFrame);
		pMainFrame->DelayUpdateFrameTitle();
		if (pMainFrame->NegotiateBorderSpace(CFrameWnd::borderSet, NULL))
			pMainFrame->DelayRecalcLayout();

		// restore original user interface on the document window
		if (pDocFrame != NULL)
		{
			pDocFrame->DelayUpdateFrameTitle();
			if (pDocFrame->NegotiateBorderSpace(CFrameWnd::borderSet, NULL))
				pDocFrame->DelayRecalcLayout();
		}
	}

	// cleanup frame interfaces allocated in GetWindowContext
	if (m_pInPlaceFrame != NULL)
	{
		OnShowControlBars(m_pInPlaceFrame->m_pFrameWnd, TRUE);

		// release OLE frame window hooks and allow menu update
		::OleSetMenuDescriptor(NULL, m_pInPlaceFrame->m_pFrameWnd->m_hWnd,
			NULL, NULL, NULL);
		if (m_pInPlaceDoc != NULL)
		{
			::OleSetMenuDescriptor(NULL, m_pInPlaceDoc->m_pFrameWnd->m_hWnd,
				NULL, NULL, NULL);
		}
		m_pInPlaceFrame->m_pFrameWnd->DelayUpdateFrameMenu(NULL);

		// unhook from frame window
		if (m_pInPlaceFrame->m_pFrameWnd->m_pNotifyHook == m_pInPlaceFrame)
			m_pInPlaceFrame->m_pFrameWnd->m_pNotifyHook = NULL;

		// cleanup document interfaces allocated in GetWindowContext
		if (m_pInPlaceDoc != NULL)
		{
			OnShowControlBars(m_pInPlaceDoc->m_pFrameWnd, TRUE);

			// unhook from frame window
			if (m_pInPlaceDoc->m_pFrameWnd->m_pNotifyHook == m_pInPlaceDoc)
				m_pInPlaceDoc->m_pFrameWnd->m_pNotifyHook = NULL;
		}
	}

	// reset server HWND -- no longer necessary
	m_hWndServer = NULL;

	CWnd* pWnd = AfxGetMainWnd();
	if (pWnd != NULL)
	{
		// set focus back to the container
		pWnd = pWnd->GetTopLevelParent();
		ASSERT_VALID(pWnd);
		if (::GetActiveWindow() == pWnd->m_hWnd)
			pWnd->SetFocus();
	}
}
예제 #9
0
void CControlBar::OnTimer(UINT_PTR nIDEvent)
{
	if (GetKeyState(VK_LBUTTON) < 0)
		return;

	AFX_MODULE_THREAD_STATE* pModuleThreadState = AfxGetModuleThreadState();

	// get current mouse position for hit test
	CPoint point; GetCursorPos(&point);
	ScreenToClient(&point);
	INT_PTR nHit = OnToolHitTest(point, NULL);
	if (nHit >= 0)
	{
		CWnd *pParent=GetTopLevelParent();
		// determine if status bar help should go away
        if(!IsTopParentActive())
        {
            nHit=-1;
        }
        else
        {
			ENSURE(pParent);
		    if(!pParent->IsWindowEnabled())
            {
			    nHit = -1;
            }
        }

		// remove status help if capture is set
		HWND hWndTip = pModuleThreadState->m_pToolTip->GetSafeHwnd();
		CWnd* pCapture = GetCapture();
		if (pCapture != this && pCapture->GetSafeHwnd() != hWndTip &&
			pCapture->GetTopLevelParent() == pParent)
		{
			nHit = -1;
		}
	}
	else
	{
		pModuleThreadState->m_nLastStatus = static_cast<INT_PTR>(-1);
	}

	// make sure it isn't over some other app's window
	if (nHit >= 0)
	{
		ClientToScreen(&point);
		HWND hWnd = ::WindowFromPoint(point);
		if (hWnd == NULL || (hWnd != m_hWnd && !::IsChild(m_hWnd, hWnd) &&
			pModuleThreadState->m_pToolTip->GetSafeHwnd() != hWnd))
		{
			nHit = -1;
			pModuleThreadState->m_nLastStatus = static_cast<INT_PTR>(-1);
		}
	}

	// handle the result
	if (nHit < 0)
	{
		if (pModuleThreadState->m_nLastStatus == static_cast<INT_PTR>(-1))
			KillTimer(ID_TIMER_CHECK);
		SetStatusText(static_cast<INT_PTR>(-1));
	}

	// set status text after initial timeout
	if (nIDEvent == ID_TIMER_WAIT)
	{
		KillTimer(ID_TIMER_WAIT);
		if (nHit >= 0)
			SetStatusText(nHit);
	}
}