当前位置: 首页>>代码示例>>C++>>正文


C++ GetCapture函数代码示例

本文整理汇总了C++中GetCapture函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCapture函数的具体用法?C++ GetCapture怎么用?C++ GetCapture使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetCapture函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnLButtonUp

void CMDIView::OnLButtonUp(UINT nFlags, CPoint point)
{
  if(this == GetCapture())
    ReleaseCapture();                                                  // Stop capturing mouse messages

  // Make sure there is an element
  if(m_pTempElement)
  { // Add the element pointer to the sketch
    
    GetDocument()->AddElement(m_pTempElement); 
    InvalidateRect(&m_pTempElement->GetEnclosingRect());
    m_pTempElement.reset();                                            // Reset the element pointer
   }
}
开发者ID:Jyang772,项目名称:MDI,代码行数:14,代码来源:MDIView.cpp

示例2: InternalDialog

int
InternalDialog(HWND hDlg)
{
    HWND    hWnd,hWndFocus,hWndCapture;
    int     rc = 0;
    MSG     msg;

    if(hDlg == 0)
        return 0;

    hWnd = GetWindowWord(hDlg,DWW_PARENT);

    if ((hWndCapture = GetCapture()))
        ReleaseCapture();

    while (IsWindow(hDlg) && (GetWindowWord(hDlg,DWW_STATUS) == 0)) {

        if(GetMessage(&msg, (HWND)0, 0, 0)) {
            if (msg.message == WM_CLOSE) {
                DispatchMessage (&msg) ;
                break;
            }
            if(IsDialogMessage(hDlg,&msg))
                continue;
            TranslateMessage (&msg) ;
            DispatchMessage (&msg) ;
        }
        if (hWnd) {	/* if there is an owner */
            if (!PeekMessage(&msg,hDlg,0,0,PM_NOREMOVE))
                SendMessage(hWnd,WM_ENTERIDLE,MSGF_DIALOGBOX,(LPARAM)hDlg);
        }
    }

    if (IsWindow(hDlg)) {
        rc = GetWindowWord(hDlg,DWW_RESULT);
        DestroyWindow(hDlg);
    }

    if(hWnd && IsWindow(hWnd)) {
        EnableWindow(hWnd, TRUE);
        if ((hWndFocus = GetDialogFocus(hWnd)))
            SetFocus(hWndFocus);
    }

    if (hWndCapture)
        SetCapture(hWndCapture);

    return rc;
}
开发者ID:ErisBlastar,项目名称:osfree,代码行数:49,代码来源:Dialog.c

示例3: OnRButtonUp

void CDiasStatusBar::OnRButtonUp (UINT nFlags, CPoint point) {
	if (GetCapture() != this) {
		ReleaseCapture ();
		return;
	}
	ReleaseCapture ();

	CRect rect1, rect2;
	GetItemRect (2, rect1);
	GetItemRect (3, rect2);

	uvar32_64 n, count = 0;
	CaImMenu menu;
	CaImMenuItem** ppItems;
	menu.CreatePopupMenu ();

	GetItemRect (2, rect1);
	GetItemRect (3, rect2);
	if (rect1.PtInRect (point) || rect2.PtInRect (point)) {
		count = theApp.GeomScales.GetCount ();
		ppItems = new CaImMenuItem*[count];
		for (n = 0; n < count; ++n) {
			ppItems[n] = new CaImMenuItem (theApp.GeomScales[n].GetName() + "\t(" + theApp.GeomScales[n].GetUnits () + ")",
				(theApp.GeomScales[aimActive].GetPos () == n) ? AMIS_CHECKED : 0);
			menu.AppendMenu (MF_STRING | MF_ENABLED | MF_OWNERDRAW, ID_TOOLS_GEOMSCALE_1 + n, (LPCTSTR)ppItems[n]);
		}
		menu.CheckMenuRadioItem (0, n, theApp.GeomScales[aimActive].GetPos (), MF_BYPOSITION);
	}
	GetItemRect (4, rect1);
	GetItemRect (5, rect2);
	if (rect1.PtInRect (point) || rect2.PtInRect (point)) {
		count = theApp.DensScales.GetCount ();
		ppItems = new CaImMenuItem*[count];
		for (n = 0; n < count; ++n) {
			ppItems[n] = new CaImMenuItem (theApp.DensScales[n].GetName() + "\t(" + theApp.DensScales[n].GetUnits () + ")",
				(theApp.DensScales[aimActive].GetPos () == n) ? AMIS_CHECKED : 0);
			menu.AppendMenu (MF_STRING | MF_ENABLED | MF_OWNERDRAW, ID_TOOLS_GEOMSCALE_1 + n, (LPCTSTR)ppItems[n]);
		}
		menu.CheckMenuRadioItem (0, n, theApp.DensScales[aimActive].GetPos (), MF_BYPOSITION);
	}

	GetWindowRect (rect2);
	menu.TrackPopupMenu (TPM_LEFTALIGN, point.x + rect2.left, point.y + rect2.top, this);

	for (n = 0; n < count; ++n)
		delete ppItems[n];
	if (count > 0)
		delete [] ppItems;
}
开发者ID:macx0r,项目名称:dias-inet,代码行数:49,代码来源:DiasStatusBar.cpp

示例4: StopCurAnimate

void SButton::OnStateChanged( DWORD dwOldState,DWORD dwNewState )
{
    StopCurAnimate();

    if(GetCapture()==m_swnd)    //点击中
        return;

    if(m_bAnimate &&
        ((dwOldState==WndState_Normal && dwNewState==WndState_Hover)
        ||(dwOldState==WndState_Hover && dwNewState==WndState_Normal)))
    {//启动动画
        m_byAlphaAni=5;
        GetContainer()->RegisterTimelineHandler(this);
    }
}
开发者ID:kenchen1101,项目名称:soui,代码行数:15,代码来源:SCmnCtrl.cpp

示例5: GetCursorPos

// 鼠标左键按下
void ProgressController::left_button_down()
{
	// 查询当前光标位置,判断光标是在滑道还是滑块上
	POINT p;
	GetCursorPos(&p);
	HWND hwnd = GetCapture();
	ScreenToClient(hwnd, &p);

	if (p.x >= m_left && p.x <= m_left + m_width)
	{
		// 如果光标在滑道上
		POINT point;
		GetCursorPos(&point); // 查询光标位置
	}
}
开发者ID:shimachao,项目名称:SLPlayer,代码行数:16,代码来源:ProgressController.cpp

示例6:

void CRoundButton2::OnCaptureChanged(CWnd *pWnd)
{
	// Check, if we lost the mouse-capture
	if (GetCapture() != this)
	{
		// We have lost the mouse-capture, so the mouse has left the buttons face
		m_bMouseOnButton = false;

		// Redraw Control, if Button is hot
		if (m_bIsHotButton)
			Invalidate();
	}

	CButton::OnCaptureChanged(pWnd);
}
开发者ID:IcyX,项目名称:bote,代码行数:15,代码来源:RoundButton2.cpp

示例7: KillTimer

void CAutoRepeatButton::OnLButtonUp(UINT nFlags, CPoint point) 
{
    KillTimer(IDT_TIMER);
	
	if(GetCapture() != NULL)
	{ /* release capture */
		ReleaseCapture();
	if(sent == 0 && (GetState() & BST_PUSHED) != 0)
	   GetParent()->SendMessage(WM_COMMAND, MAKELONG(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd);
	} /* release capture */
       
	   
    
    //CButton::OnLButtonUp(nFlags, point);
}
开发者ID:drkjschmidt,项目名称:rudolf,代码行数:15,代码来源:AutoRepeatButton.cpp

示例8: OnMouseMove

// on mouse move
void CSplitterFrame::OnMouseMove(UINT nFlags, CPoint point)
{
    if(GetCapture()==this) {
        CPoint ptCursor;
        GetCursorPos(&ptCursor);
        CPoint pt = GetAbsPosition();
        if(sp_uiDockSide==AFX_IDW_DOCKBAR_LEFT || sp_uiDockSide==AFX_IDW_DOCKBAR_RIGHT) {
            pt.x = ptCursor.x;
        } else if(sp_uiDockSide==AFX_IDW_DOCKBAR_TOP || sp_uiDockSide==AFX_IDW_DOCKBAR_BOTTOM) {
            pt.y = ptCursor.y;
        }
        SetAbsPosition(pt);
    }
    CWnd::OnMouseMove(nFlags, point);
}
开发者ID:rdrago,项目名称:LCSource,代码行数:16,代码来源:SplitterFrame.cpp

示例9: OnLButtonUp

void CSketcherView::OnLButtonUp(UINT nFlags, CPoint point)
{
   if(this == GetCapture())
      ReleaseCapture();        // Stop capturing mouse messages

   // Make sure there is an element
   if(m_pTempElement)
   {
      // Call a document class function to store the element
      // pointed to by m_pTempElement in the document object

      delete m_pTempElement;           // This code is temporary
      m_pTempElement = 0;              // Reset the element pointer
   }
}
开发者ID:ktjones,项目名称:BVC2010,代码行数:15,代码来源:SketcherView.cpp

示例10: OnLButtonUp

LTBOOL	CFolderJoin::OnLButtonUp(int x, int y)
{

	if (bDblClick)
	{
		bDblClick = LTFALSE;
		return LTFALSE;
	}

	if (GetCapture())
	{
		return m_pPassEdit->OnEnter();
	}
	return CBaseFolder::OnLButtonUp(x,y);
}
开发者ID:germanocaldeira,项目名称:no-one-lives-forever,代码行数:15,代码来源:FolderJoin.cpp

示例11: InitToolTip

BOOL CExtButton::PreTranslateMessage(MSG* pMsg) 
{
	if( !CExtPopupMenuWnd::IsMenuTracking() )
	{
		InitToolTip();
		m_ToolTip.RelayEvent(pMsg);
	}

//	if( CExtPopupMenuWnd::IsMenuTracking() )
//		return TRUE;
	if(		(	pMsg->message == WM_KEYDOWN
				|| pMsg->message == WM_KEYUP
			)
		&&
			(	pMsg->wParam == VK_RETURN
				|| pMsg->wParam == VK_SPACE
			)
		)
	{
		if( IsWindowEnabled() && IsWindowVisible() && (!m_bPushTracking) )
		{
			if(	(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
				||
				(pMsg->message == WM_KEYUP && pMsg->wParam == VK_SPACE)
				)
			{
				if( GetCapture() == this )
					ReleaseCapture();
				m_bMouseOver = m_bPushed = m_bPushTracking = m_bKeyTracking = FALSE;
				Invalidate();
				UpdateWindow();
				_OnClick();
				return TRUE;
			}
			if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_SPACE)
			{
				m_bMouseOver = m_bPushed = m_bKeyTracking = TRUE;
				SetCapture();
				Invalidate();
				UpdateWindow();
				return TRUE;
			}
		} // if( IsWindowEnabled() && IsWindowVisible() && (!m_bPushTracking) )
		return TRUE;
	}

	return CButton::PreTranslateMessage(pMsg);
}
开发者ID:darwinbeing,项目名称:trade,代码行数:48,代码来源:ExtButton.cpp

示例12: switch

//////////////////
// Change state for finite-state-machine.
//
void CDragDropMgr::SetState(UINT iState)
{
//	TRACE(_T("CDragDropMgr::SetState %d\n"),iState);
	
	if (iState != m_iState) 
    {
		switch (iState)
		{
		case CAPTURED:
			::SetCapture(m_hwndTracking);	 // capture mouse input
			break;
			
        case LDRAGGING:
        case RDRAGGING:
			m_hCursorSave = GetCursor();	 // save current cursor
			break;
			
		default: // NONE
			if (GetCapture() == m_hwndTracking)
				::ReleaseCapture();				 // release capture and..
			
			SetCursor(m_hCursorSave);		 // ..restore cursor
			
            if (m_pDragImage) 
            {
				m_pDragImage->DragLeave(CWnd::FromHandle(m_ddi.hwndTarget));
				m_pDragImage->EndDrag();	 // end drawing and..
				
				delete m_pDragImage;			 // ..destroy..
				m_pDragImage=NULL;			 // ..image list
			}

			if (m_hwndTracking)
				InvalidateRect(m_hwndTracking, NULL, FALSE);

			if (m_ddi.hwndTarget)
				InvalidateRect(m_ddi.hwndTarget, NULL, FALSE);

			delete m_ddi.pData;
			m_ddi.pData = NULL;
			m_hwndTracking = NULL;
			
			break;
		}
		
		m_iState = iState;
	}
}
开发者ID:jithuin,项目名称:infogeezer,代码行数:51,代码来源:DragDrop.cpp

示例13: TraceRect

void
ZListTip::OnMouseMove( UINT uFlags, CPoint pt )
{
#ifdef DEBUG_ALL
   TraceRect( "ZListTip::OnMouseMove rectTitle: ", m_rectTitle );
   TracePoint( "ZListTip::OnMouseMove pt: ", pt );
#endif
   if ( m_rectTitle.PtInRect( pt ) == FALSE )
   {
#ifdef DEBUG_ALL
   TracePoint( "ZListTip::OnMouseMove PtInRect: ", pt );
#endif

#if 0
      if ( GetCapture( ) == this )
         ReleaseCapture( );

      SetWindowPos( 0, 0, 0, 0, 0,
                    SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOSIZE |
                      SWP_NOZORDER | SWP_NOACTIVATE );
#else
      Hide( );
#endif

      // Forward the message
      ClientToScreen( &pt );
      CWnd *pWnd = WindowFromPoint( pt );
      if ( pWnd == this )
         pWnd = m_pParentWnd;

      CWnd *pWndTemp = GetFocus( );
      if ( pWndTemp != pWnd )
         pWnd->SetFocus( );

      zLONG lParam = MAKELONG( pt.x, pt.y );
      int nHitTest = (int) pWnd->SendMessage( WM_NCHITTEST, 0, lParam );
      if ( nHitTest == HTCLIENT )
      {
         pWnd->ScreenToClient( &pt );
         lParam = MAKELONG( pt.x, pt.y );
         pWnd->PostMessage( WM_MOUSEMOVE, uFlags, lParam );
      }
      else
      {
         pWnd->PostMessage( WM_NCMOUSEMOVE, nHitTest, lParam );
      }
   }
}
开发者ID:DeegC,项目名称:ZeidonTools,代码行数:48,代码来源:ZdCtl.cpp

示例14: get_keyboard_lparam

bool track_bar::on_hooked_message(message_hook_manager::t_message_hook_type p_type, int code, WPARAM wp, LPARAM lp)
{
    win32_keyboard_lparam & lpkeyb = get_keyboard_lparam(lp);
    if (wp == VK_ESCAPE && !lpkeyb.transition_code && !lpkeyb.previous_key_state)
    {
        destroy_tooltip();
        if (GetCapture() == get_wnd())
            ReleaseCapture();
        m_dragging = false;
        set_position_internal(m_position);
        message_hook_manager::deregister_hook(message_hook_manager::type_keyboard, this);
        m_hook_registered=false;
        return true;
    }
    return false;
}
开发者ID:samithaj,项目名称:columns_ui,代码行数:16,代码来源:trackbar.cpp

示例15: _GetButtonPtr

void CFlatToolbar::OnCancelMode()
{
	CControlBar::OnCancelMode();

	if (m_iButtonCapture >= 0)
	{
		AFX_TBBUTTON* pTBB = _GetButtonPtr(m_iButtonCapture);
		ASSERT(!(pTBB->nStyle & TBBS_SEPARATOR));
		UINT nNewStyle = (pTBB->nStyle & ~TBBS_PRESSED);
		if (GetCapture() == this)
			ReleaseCapture();
		SetButtonStyle(m_iButtonCapture, nNewStyle);
		m_iButtonCapture = -1;
		UpdateWindow();
	}
}
开发者ID:Joincheng,项目名称:lithtech,代码行数:16,代码来源:flattoolbar.cpp


注:本文中的GetCapture函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。