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


C++ ReleaseCapture函数代码示例

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


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

示例1: NcAreaWndSubclassProc


//.........这里部分代码省略.........

                RedrawWindow(hWnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE);
            }
        }
        break;
    case WM_LBUTTONUP:
        {
            POINT windowPoint;
            RECT windowRect;

            // Get the screen coordinates of the mouse.
            windowPoint.x = GET_X_LPARAM(lParam);
            windowPoint.y = GET_Y_LPARAM(lParam);

            // Get the screen coordinates of the window.
            GetWindowRect(hWnd, &windowRect);

            // Adjust the coordinates (start from 0,0).
            OffsetRect(&windowRect, -windowRect.left, -windowRect.top);

            // Get the position of the inserted button.
            NcAreaGetButtonRect(context, &windowRect);

            // Check that the mouse is within the inserted button.
            if (PtInRect(&windowRect, windowPoint))
            {
                // Forward click notification.
                SendMessage(PhMainWndHandle, WM_COMMAND, MAKEWPARAM(context->CommandID, BN_CLICKED), 0);
            }

            if (GetCapture() == hWnd)
            {
                context->Pushed = FALSE;
                ReleaseCapture();
            }

            RedrawWindow(hWnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE);
        }
        break;
    case WM_KEYDOWN:
        {
            if (wParam == '\t' || wParam == '\r')
            {
                HWND tnHandle;

                tnHandle = GetCurrentTreeNewHandle();

                if (tnHandle)
                {
                    SetFocus(tnHandle);

                    if (wParam == '\r')
                    {
                        if (TreeNew_GetFlatNodeCount(tnHandle) > 0)
                        {
                            TreeNew_DeselectRange(tnHandle, 0, -1);
                            TreeNew_SelectRange(tnHandle, 0, 0);
                            TreeNew_SetFocusNode(tnHandle, TreeNew_GetFlatNode(tnHandle, 0));
                            TreeNew_SetMarkNode(tnHandle, TreeNew_GetFlatNode(tnHandle, 0));
                        }
                    }
                }
                else
                {
                    PTOOLSTATUS_TAB_INFO tabInfo;
开发者ID:TETYYS,项目名称:processhacker2,代码行数:66,代码来源:searchbox.c

示例2: switch


//.........这里部分代码省略.........
					m_pDC.SetTextColor( RGB( 0, 0, 0 ));

					// Capture the mouse.
					SetCapture();

					// We are moving the splitter.
					m_bIsMoving = TRUE;

					// We want the keyboard focus.
					m_hFocus = ::SetFocus( *this );

					// Show the track bar.
					DrawSplitterBar();
					return 0;
				}

				// Failure...
				::ReleaseDC( *GetParent(), m_pDC.Detach());
			}
			return 0;
		}

		case	WM_MOUSEMOVE:
			// Are we moving the splitter?
			if ( m_bIsMoving )
			{
				// Get the current mouse position.
				ClsPoint p;
				GetCursorPos( p );

				// Map the position to our parent.
				GetParent()->ScreenToClient(p);

				// Get position (Horizontal or vertical).
				int nPos = m_bIsHorizontal ? p.X() : p.Y();

				// Set splitter position.
				SetSplitterPosition( nPos );
				return 0;
			}
			break;

		case	WM_GETDLGCODE:
			// We want them all.
			return DLGC_WANTALLKEYS;

		case	WM_KEYDOWN:
			// Are we moving the splitter or was a key
			// pressed other than escape?
			if ( ! m_bIsMoving || wParam != VK_ESCAPE )
				// Pass the message to the base class.
				break;

			// Erase the splitter if necessary.
			if ( m_bIsVisible ) DrawSplitterBar();

			// Restore the old position.
			m_nPosition = m_nStartPosition;

			// Fall through which will stop the
			// mouse tracking etc.


		case	WM_LBUTTONUP:
			// Are we moving?
			if ( m_bIsMoving )
			{
				// Make sure we are invisible.
				if ( m_bIsVisible ) DrawSplitterBar();

				// Restore DC snapshot.
				m_pDC.RestoreDC( m_nSaveDC );

				// Release it and detach it from the object.
				::ReleaseDC( *GetParent(), m_pDC.Detach());

				// Release the mouse.
				ReleaseCapture();

				// No longer moving.
				m_bIsMoving = FALSE;

				// Move the panes.
				MoveSplitter();

				// Restore the focus.
				::SetFocus( m_hFocus );
			}
			return 0;

		case WM_SETCURSOR:
			// Setup the correct cursor.
			if ( m_bIsHorizontal ) SetCursor( m_hVert );
			else		       SetCursor( m_hHorz );
			return 0;
	}

	// Call the base class.
	return ClsWindow::WindowProc( uMsg, wParam, lParam );
}
开发者ID:jcbaar,项目名称:ClassLib,代码行数:101,代码来源:splitter.cpp

示例3: switch


//.........这里部分代码省略.........
            Args.FObjArg = (iObject*)L_MOTION_MOVE;
            Args.FBoolArg = Env->Console->IsKeyPressed( LK_LBUTTON );

            // make the gestures' handlers happy
            Env->SendSync( L_EVENT_MOTION, LEventArgs( -1, 0, 0, false ), false );
            Env->SendSync( L_EVENT_MOTION, Args, false );
            Env->SendSync( L_EVENT_MOTION, LEventArgs( -2, 0, 0, false ), false );
            break;
        }
        case WM_XBUTTONDOWN:
        {
            SetCapture( Window );

            int Key = LK_XBUTTON1;

            switch HIWORD( wParam )
            {
            case XBUTTON1:
                Key = LK_XBUTTON1;
                break;
            case XBUTTON2:
                Key = LK_XBUTTON2;
                break;
            default:
                Env->Logger->Log( L_WARNING, "Unknown wParam in WM_XBUTTONDOWN: " + LStr::ToStr( LOWORD( wParam ) ) );
            }

            Env->SendSync( L_EVENT_KEY, LEventArgs( Key, true ), false );

            return FOriginalWndProc ? CallWindowProc( FOriginalWndProc, Window, Msg, wParam, lParam ) : 1;
        }
        case WM_XBUTTONUP:
        {
            ReleaseCapture();

            int Key = LK_XBUTTON1;

            switch HIWORD( wParam )
            {
            case XBUTTON1:
                Key = LK_XBUTTON1;
                break;
            case XBUTTON2:
                Key = LK_XBUTTON2;
                break;
            default:
                Env->Logger->Log( L_WARNING, "Unknown wParam in WM_XBUTTONUP: " + LStr::ToStr( LOWORD( wParam ) ) );
            }

            Env->SendSync( L_EVENT_KEY, LEventArgs( Key, false ), false );

            return FOriginalWndProc ? CallWindowProc( FOriginalWndProc, Window, Msg, wParam, lParam ) : 1;
        }
        case WM_LBUTTONDOWN:
        {
            SetForegroundWindow( Window );
            SetFocus( Window );

            SetCapture( Window );

            Env->SendSync( L_EVENT_KEY, LEventArgs( LK_LBUTTON, true ), false );

            LVector2 Pos = Env->Viewport->GetMousePosition();
            LEventArgs Args( 0, Pos.x, Pos.y, false );
            Args.FObjArg = (iObject*)L_MOTION_DOWN;
            Args.FBoolArg = true;
开发者ID:mildrock,项目名称:Carousel3D,代码行数:67,代码来源:Viewport.cpp

示例4: WCam_WndProc


//.........这里部分代码省略.........
        { 
			PAINTSTRUCT	ps;
			WINDOWPLACEMENT wp;
			double	start, end;
			int		i;
			
			memset( &wp, 0, sizeof( wp ) );
			wp.length = sizeof( wp );
			GetWindowPlacement( g_qeglobals.d_hwndCamera, &wp );
			
			MoveWindow( g_qeglobals.d_hwndCamera, 30, 30, 400, 400, TRUE );
			
			BeginPaint(hWnd, &ps);
            if (!wglMakeCurrent( g_qeglobals.d_hdcBase, g_qeglobals.d_hglrcBase))
				Error ("wglMakeCurrent failed");
			glDrawBuffer (GL_FRONT);
			
			start = Sys_DoubleTime ();
			for (i=0 ; i<100 ; i++)
			{
				camera.angles[YAW] = i*4;
				Cam_Draw ();
			}
			wglSwapBuffers(g_qeglobals.d_hdcBase);
			glDrawBuffer (GL_BACK);
			end = Sys_DoubleTime ();
			EndPaint(hWnd, &ps);
			Sys_Printf ("%5.2f seconds\n", end-start);

			SetWindowPlacement( g_qeglobals.d_hwndCamera, &wp );
        }
		break;
		
	case WM_KEYDOWN:
		if ( QE_KeyDown (wParam) )
			return 0;
		else 
			return DefWindowProc( hWnd, uMsg, wParam, lParam );
		
	case WM_MBUTTONDOWN:
	case WM_RBUTTONDOWN:
	case WM_LBUTTONDOWN:
		if (GetTopWindow(g_qeglobals.d_hwndMain) != hWnd)
			BringWindowToTop(hWnd);
		
		SetFocus (g_qeglobals.d_hwndCamera);
		SetCapture (g_qeglobals.d_hwndCamera);
		fwKeys = wParam;        // key flags 
		xPos = (short)LOWORD(lParam);  // horizontal position of cursor 
		yPos = (short)HIWORD(lParam);  // vertical position of cursor 
		yPos = (int)rect.bottom - 1 - yPos;
		Cam_MouseDown (xPos, yPos, fwKeys);
		return 0;
		
	case WM_MBUTTONUP:
	case WM_RBUTTONUP:
	case WM_LBUTTONUP:
		fwKeys = wParam;        // key flags 
		xPos = (short)LOWORD(lParam);  // horizontal position of cursor 
		yPos = (short)HIWORD(lParam);  // vertical position of cursor 
		yPos = (int)rect.bottom - 1 - yPos;
		Cam_MouseUp (xPos, yPos, fwKeys);
		if (! (fwKeys & (MK_LBUTTON|MK_RBUTTON|MK_MBUTTON)))
			ReleaseCapture ();
		return 0;
		
	case WM_MOUSEMOVE:
		fwKeys = wParam;        // key flags 
		xPos = (short)LOWORD(lParam);  // horizontal position of cursor 
		yPos = (short)HIWORD(lParam);  // vertical position of cursor 
		yPos = (int)rect.bottom - 1 - yPos;
		Cam_MouseMoved (xPos, yPos, fwKeys);
		return 0;
		
	case WM_SIZE:
		camera.width = rect.right;
		camera.height = rect.bottom;
		InvalidateRect(g_qeglobals.d_hwndCamera, NULL, false);
		return 0;

	case WM_KILLFOCUS:
	case WM_SETFOCUS:
		SendMessage( hWnd, WM_NCACTIVATE, uMsg == WM_SETFOCUS, 0 );
		return 0;

	case WM_NCCALCSIZE:// don't let windows copy pixels
		DefWindowProc (hWnd, uMsg, wParam, lParam);
		return WVR_REDRAW;

	case WM_CLOSE:
		DestroyWindow (hWnd);
		return 0;
		
	case WM_DESTROY:
		QEW_StopGL( hWnd, g_qeglobals.d_hglrcBase, g_qeglobals.d_hdcBase );
		return 0;
    }

	return DefWindowProc( hWnd, uMsg, wParam, lParam );
}
开发者ID:FS-NulL,项目名称:Q3Radiant,代码行数:101,代码来源:WIN_CAM.CPP

示例5: GetDlgItem


//.........这里部分代码省略.........
  pListCtrlLIST = (CListCtrl *)GetDlgItem(CCFE_LIST);
  pButtonTHISISA = (CButton *)GetDlgItem(CCFE_THISISA);
 	pWndDATETIME = GetDlgItem(CCFE_DATETIME);
  pWndRECEIVEDBY = GetDlgItem(CCFE_RECEIVEDBY);
  pButtonCOMPLAINT = (CButton *)GetDlgItem(CCFE_COMPLAINT);
  pButtonCOMMENDATION = (CButton *)GetDlgItem(CCFE_COMMENDATION);
  pButtonSERVICEREQUEST = (CButton *)GetDlgItem(CCFE_SERVICEREQUEST);
  pButtonMISCELLANEOUS = (CButton *)GetDlgItem(CCFE_MISCELLANEOUS);
  pStaticJUMPTO_TEXT = (CStatic *)GetDlgItem(CCFE_JUMPTO_TEXT);
  pEditJUMPTO = (CEdit *)GetDlgItem(CCFE_JUMPTO);
  pButtonDISPLAYCANCELLED = (CButton *)GetDlgItem(CCFE_DISPLAYCANCELLED);
  pButtonREOPEN = (CButton *)GetDlgItem(IDREOPEN);

  DWORD dwExStyles = pListCtrlLIST->GetExtendedStyle();
  pListCtrlLIST->SetExtendedStyle(dwExStyles | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_INFOTIP);
//
//  Set up the characters that the "referenceNumber" is prefixed by
//
//  Complaint, Commendation, or Service Request
//
  strncpy(cPrefix, "CMSL", 4);
//
//  Get the current date and time and put it on the group box
//  
  CTime time = CTime::GetCurrentTime();
 	CString strTime = time.Format(_T("%A, %B %d, %Y at %I:%M:%S%p"));
//
//  Set up the timer to update the date/time
//
  pWndDATETIME->SetWindowText(strTime);
 	pWndDATETIME->SetTimer(0x1000, 1000, TimerProc);
//
//  Display the user name
//
  pWndRECEIVEDBY->SetWindowText(userName);
//
//  Set up the list control
//
  LVCOLUMN LVC;
  LVC.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
  LVC.fmt = LVCFMT_LEFT;
  LVC.cx = 100;
  LVC.pszText = "Number";
  pListCtrlLIST->InsertColumn(0, &LVC);
  LVC.cx = 100;
  LVC.pszText = "Status";
  pListCtrlLIST->InsertColumn(1, &LVC);
  LVC.cx = 300;
  LVC.pszText = "Name";
  pListCtrlLIST->InsertColumn(2, &LVC);
  bSortForward[0] = TRUE;
  bSortForward[1] = TRUE;
  bSortForward[2] = TRUE;
  PopulateListCtrl();
//
//  Disable the list control for now
//
  pListCtrlLIST->EnableWindow(FALSE);
  pStaticJUMPTO_TEXT->EnableWindow(FALSE);
  pEditJUMPTO->EnableWindow(FALSE);

  pButtonNEW->SetCheck(TRUE);
  pButtonCOMPLAINT->SetCheck(TRUE);
  pButtonCOMPLAINT->SetFocus();
//
//  Set up the referral structure
//
  int nI;

  CCFE.numReferrals = m_numReferrals;

  if(m_numReferrals == 0)
  {
    CCFE.pCCREFER = NULL;
  }
  else
  {
    CCFE.pCCREFER = (CCREFERDef *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CCREFERDef) * m_numReferrals); 
    if(CCFE.pCCREFER == NULL)
    {
      AllocationError(__FILE__, __LINE__, FALSE);
    }
    else
    {
      for(nI = 0; nI < m_numReferrals; nI++)
      {
        strcpy(CCFE.pCCREFER[nI].szName, m_Referrals[nI].szName);
        strcpy(CCFE.pCCREFER[nI].szDepartment, m_Referrals[nI].szDepartment);
        strcpy(CCFE.pCCREFER[nI].szEmailAddress, m_Referrals[nI].szEmailAddress);
        CCFE.pCCREFER[nI].flags = 0;
      }
    }
  }

  ReleaseCapture();


 	return FALSE;  // return TRUE unless you set the focus to a control
                 // EXCEPTION: OCX Property Pages should return FALSE
}
开发者ID:ems,项目名称:TMS,代码行数:101,代码来源:CCFrontEnd.cpp

示例6: Reposition

void CXTPTabManager::TrackClick(HWND hWnd, CPoint pt, CXTPTabManagerItem* pItem)
{
	if (GetPaintManager()->m_bHotTracking)
		m_pHighlighted = pItem;

	m_pPressed = pItem;
	BOOL bHighlighted = TRUE;

	Reposition();
	BOOL bAccept = FALSE;

	::SetCapture(hWnd);

	while (::GetCapture() == hWnd)
	{
		MSG msg;
		VERIFY(::GetMessage(&msg, NULL, 0, 0));

		if (::GetCapture() != hWnd)
		{
			DispatchMessage (&msg);
			break;
		}
		switch (msg.message)
		{
			case WM_MOUSEMOVE:
				{
					pt = CPoint((short signed)LOWORD(msg.lParam), (short signed)HIWORD(msg.lParam));

					bHighlighted = pItem->GetRect().PtInRect(pt);

					if (GetPaintManager()->m_bHotTracking)
					{
						CXTPTabManagerItem* pHighlighted = bHighlighted ? pItem : NULL;
						if (pHighlighted != m_pHighlighted)
						{
							m_pHighlighted = pHighlighted;
							RedrawControl(pItem->GetRect(), TRUE);
						}
					}

				}

				break;

			case WM_KEYDOWN:
				if (msg.wParam != VK_ESCAPE)
					break;
			case WM_CANCELMODE:
			case WM_RBUTTONDOWN:
				goto ExitLoop;

			case WM_LBUTTONUP:
				bAccept = TRUE;
				goto ExitLoop;

			default:
				DispatchMessage (&msg);
				break;
		}
	}

ExitLoop:
	ReleaseCapture();

	m_pPressed = FALSE;

	PerformMouseMove(hWnd, pt);

	RedrawControl(NULL, FALSE);

	if (bAccept && bHighlighted)
	{
		OnItemClick(pItem);
	}
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:76,代码来源:XTPTabManager.cpp

示例7: GetTickCount

void CXTPTabManagerNavigateButton::PerformClick(HWND hWnd, CPoint pt)
{
	if ((::GetCapture() != NULL) || !m_bEnabled)
		return;

	::SetCapture(hWnd);

	BOOL  bClick = FALSE;

	DWORD dwStart = GetTickCount();
	for (;;)
	{
		if (m_bEnabled && GetTickCount() - dwStart > 20)
		{
			dwStart = GetTickCount();
			OnExecute(TRUE);
		}

		BOOL bPressed = m_rcButton.PtInRect(pt);

		if (bPressed != m_bPressed)
		{
			m_bPressed = bPressed;
			m_pManager->RedrawControl(m_rcButton, TRUE);
		}
		MSG msg;

		if (!::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE))
			continue;

		VERIFY(::GetMessage(&msg, NULL, 0, 0));

		if (::GetCapture() != hWnd)
		{
			DispatchMessage (&msg);
			goto ExitLoop;
		}
		switch (msg.message)
		{
			case WM_MOUSEMOVE:
				pt = CPoint((short signed)LOWORD(msg.lParam), (short signed)HIWORD(msg.lParam));
				break;

			case WM_LBUTTONUP:
				bClick = m_bPressed;
				goto ExitLoop;

			case WM_KEYDOWN:
				if (msg.wParam != VK_ESCAPE)
					break;

			case WM_CANCELMODE:
			case WM_RBUTTONDOWN:
				goto ExitLoop;

			default:
				DispatchMessage (&msg);
				break;
		}
	}

ExitLoop:
	ReleaseCapture();
	m_bPressed = FALSE;
	m_pManager->PerformMouseMove(hWnd, pt);
	m_pManager->RedrawControl(NULL, FALSE);

	if (bClick)
	{
		OnExecute(FALSE);
	}
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:72,代码来源:XTPTabManager.cpp

示例8: EngineOutputProc

// This seems pure front end
LRESULT CALLBACK EngineOutputProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
    static SnapData sd;

    switch (message) {
    case WM_INITDIALOG:
        if( engineOutputDialog == NULL ) {
            engineOutputDialog = hDlg;

            Translate(hDlg, DLG_EngineOutput);
            RestoreWindowPlacement( hDlg, &wpEngineOutput ); /* Restore window placement */

            ResizeWindowControls( windowMode );

            SendDlgItemMessage( hDlg, IDC_EngineMemo1, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS );
            SendDlgItemMessage( hDlg, IDC_EngineMemo2, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS );

	    /* Set font */
	    SendDlgItemMessage( engineOutputDialog, IDC_EngineMemo1, WM_SETFONT, (WPARAM)font[boardSize][MOVEHISTORY_FONT]->hf, MAKELPARAM(TRUE, 0 ));
	    SendDlgItemMessage( engineOutputDialog, IDC_EngineMemo2, WM_SETFONT, (WPARAM)font[boardSize][MOVEHISTORY_FONT]->hf, MAKELPARAM(TRUE, 0 ));

            SetEngineState( 0, STATE_IDLE, "" );
            SetEngineState( 1, STATE_IDLE, "" );
        }

        return FALSE;

    case WM_COMMAND:
        switch (LOWORD(wParam)) {
        case IDOK:
          EndDialog(hDlg, TRUE);
          return TRUE;

        case IDCANCEL:
          EndDialog(hDlg, FALSE);
          return TRUE;

        default:
          break;
        }

        break;

    case WM_MOUSEMOVE:
        MovePV(LOWORD(lParam) - boardRect.left, HIWORD(lParam) - boardRect.top, boardRect.bottom - boardRect.top);
        break;

    case WM_RBUTTONUP:
        ReleaseCapture();
        SendMessage( outputField[currentPV][nMemo], EM_SETSEL, 0, 0 );
        highTextStart[currentPV] = highTextEnd[currentPV] = 0;
        UnLoadPV();
        break;

    case WM_NOTIFY:
        if( wParam == IDC_EngineMemo1 || wParam == IDC_EngineMemo2 ) {
            MSGFILTER * lpMF = (MSGFILTER *) lParam;
            if( lpMF->msg == WM_RBUTTONDOWN && (lpMF->wParam & (MK_CONTROL | MK_SHIFT)) == 0 ) {
                currentPV = (wParam == IDC_EngineMemo2);
                GetMemoLine(hDlg, LOWORD(lpMF->lParam), HIWORD(lpMF->lParam));
            }
        }
        break;

    case WM_GETMINMAXINFO:
        {
            MINMAXINFO * mmi = (MINMAXINFO *) lParam;
        
            mmi->ptMinTrackSize.x = 100;
            mmi->ptMinTrackSize.y = 160;
        }
        break;

    case WM_CLOSE:
        EngineOutputPopDown();
        break;

    case WM_SIZE:
        ResizeWindowControls( windowMode );
        break;

    case WM_ENTERSIZEMOVE:
        return OnEnterSizeMove( &sd, hDlg, wParam, lParam );

    case WM_SIZING:
        return OnSizing( &sd, hDlg, wParam, lParam );

    case WM_MOVING:
        return OnMoving( &sd, hDlg, wParam, lParam );

    case WM_EXITSIZEMOVE:
        return OnExitSizeMove( &sd, hDlg, wParam, lParam );
    }

    return FALSE;
}
开发者ID:wjkeller,项目名称:ecs40,代码行数:97,代码来源:wengineoutput.c

示例9: switch

LRESULT CCEGLView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	PAINTSTRUCT ps;

	switch (message)
	{
	case WM_LBUTTONDOWN:
		if (m_pDelegate && m_pTouch && MK_LBUTTON == wParam)
		{
            POINT pt = {(short)LOWORD(lParam), (short)HIWORD(lParam)};
            if (PtInRect(&m_rcViewPort, pt))
            {
                m_bCaptured = true;
                SetCapture(m_hWnd);
                m_pTouch->SetTouchInfo(0, (float)(pt.x - m_rcViewPort.left) / m_fScreenScaleFactor,
                    (float)(pt.y - m_rcViewPort.top) / m_fScreenScaleFactor);
                m_pSet->addObject(m_pTouch);
                m_pDelegate->touchesBegan(m_pSet, NULL);
            }
		}
		break;

	case WM_MOUSEMOVE:
		if (MK_LBUTTON == wParam && m_bCaptured)
		{
            m_pTouch->SetTouchInfo(0, (float)((short)LOWORD(lParam)- m_rcViewPort.left) / m_fScreenScaleFactor,
                (float)((short)HIWORD(lParam) - m_rcViewPort.top) / m_fScreenScaleFactor);
            m_pDelegate->touchesMoved(m_pSet, NULL);
		}
		break;

	case WM_LBUTTONUP:
		if (m_bCaptured)
		{
			m_pTouch->SetTouchInfo(0, (float)((short)LOWORD(lParam)- m_rcViewPort.left) / m_fScreenScaleFactor,
                (float)((short)HIWORD(lParam) - m_rcViewPort.top) / m_fScreenScaleFactor);
			m_pDelegate->touchesEnded(m_pSet, NULL);
			m_pSet->removeObject(m_pTouch);
            ReleaseCapture();
			m_bCaptured = false;
		}
		break;
	case WM_SIZE:
		switch (wParam)
		{
		case SIZE_RESTORED:
			CCApplication::sharedApplication().applicationWillEnterForeground();
			break;
		case SIZE_MINIMIZED:
			CCApplication::sharedApplication().applicationDidEnterBackground();
			break;
		}
		break;
	case WM_KEYDOWN:
		if (wParam == VK_F1 || wParam == VK_F2)
		{
			if (GetKeyState(VK_LSHIFT) < 0 ||  GetKeyState(VK_RSHIFT) < 0 || GetKeyState(VK_SHIFT) < 0)
				CCKeypadDispatcher::sharedDispatcher()->dispatchKeypadMSG(wParam == VK_F1 ? kTypeBackClicked : kTypeMenuClicked);
		}
		if ( m_lpfnAccelerometerKeyHook!=NULL )
		{
			(*m_lpfnAccelerometerKeyHook)( message,wParam,lParam );
		}
		break;
	case WM_KEYUP:
		if ( m_lpfnAccelerometerKeyHook!=NULL )
		{
			(*m_lpfnAccelerometerKeyHook)( message,wParam,lParam );
		}
		break;
    case WM_CHAR:
        {
            if (wParam < 0x20)
            {
                if (VK_BACK == wParam)
                {
                    CCIMEDispatcher::sharedDispatcher()->dispatchDeleteBackward();
                }
                else if (VK_RETURN == wParam)
                {
                    CCIMEDispatcher::sharedDispatcher()->dispatchInsertText("\n", 1);
                }
                else if (VK_TAB == wParam)
                {
                    // tab input
                }
                else if (VK_ESCAPE == wParam)
                {
                    // ESC input
					CCDirector::sharedDirector()->end();
                }
            }
            else if (wParam < 128)
            {
                // ascii char
                CCIMEDispatcher::sharedDispatcher()->dispatchInsertText((const char *)&wParam, 1);
            }
            else
            {
                char szUtf8[8] = {0};
//.........这里部分代码省略.........
开发者ID:KerwinMa,项目名称:NDRemoteTest,代码行数:101,代码来源:CCEGLView_win32.cpp

示例10: GetDockingPaneManager

void CXTPDockingPaneSplitterWnd::OnLButtonDown(UINT /*nFlags*/, CPoint point)
{
	if (m_pContainer == 0)
		return;

	CXTPDockingPaneManager* pManager = GetDockingPaneManager();

	if (pManager->IsSplittersLocked())
		return;

	CXTPWindowRect rc(this);

	CRect rcAvail, rcUnion;
	if (!GetAvailableRect(rcAvail, rcUnion))
		return;

	if (m_pContainer->OnAction(xtpPaneActionSplitterResizing))
		return;

	m_pContainer->NormalizeDockingSize();

	BOOL bHoriz = m_pContainer->m_bHoriz;


	//point = rc.TopLeft();
	ClientToScreen(&point);

	if (pManager->IsSplitterTrackerUsed())
	{

		CXTPSplitterTracker tracker;
		BOOL bAccept = tracker.Track(this, rcAvail, rc, point, bHoriz);

		if (bAccept)
		{
			Reposition(rc, rcUnion);


			pManager->RecalcFrameLayout(m_pContainer, TRUE);
		}
	}
	else
	{
		CPoint ptOffset = bHoriz ? CPoint(rc.left - point.x, 0) :
			CPoint(0, rc.top - point.y);

		SetCapture();

		while (::GetCapture() == m_hWnd)
		{
			MSG msg;

			while (::PeekMessage(&msg, NULL, WM_PAINT, WM_PAINT, PM_REMOVE | PM_NOYIELD))
			{
				DispatchMessage(&msg);
			}

			if (!GetMessage(&msg, NULL, 0, 0))
				break;

			if (msg.message == WM_MOUSEMOVE)
			{

				point = CPoint(msg.lParam);
				ClientToScreen(&point);
				point += ptOffset;

				point.x = max(min(point.x, rcAvail.right), rcAvail.left);
				point.y = max(min(point.y, rcAvail.bottom), rcAvail.top);

				if (bHoriz)
				{
					if (rc.left == point.x)
						continue;
					rc.OffsetRect(point.x - rc.left, 0);
				}
				else
				{
					if (rc.top == point.y)
						continue;
					rc.OffsetRect(0, point.y - rc.top);
				}

				Reposition(rc, rcUnion);

				pManager->RecalcFrameLayout(m_pContainer);
			}
			else if (msg.message == WM_KEYDOWN && msg.wParam == VK_ESCAPE) break;
			else if (msg.message == WM_LBUTTONUP) break;
			else ::DispatchMessage(&msg);
		}

		if (CWnd::GetCapture() == this) ReleaseCapture();
	}

	m_pContainer->OnAction(xtpPaneActionSplitterResized);
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:97,代码来源:XTPDockingPaneSplitterContainer.cpp

示例11: ReleaseCapture

r3dKeyboard::~r3dKeyboard()
{
	ReleaseCapture();
}
开发者ID:Mateuus,项目名称:devsrc,代码行数:4,代码来源:r3dInput.cpp

示例12: TEXT

LRESULT CALLBACK CToolbarWnd::WndProc( HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam )
{
	CToolbarWnd* pThis = NULL;
	if(IsWindow(hWnd))
	{
		pThis = (CToolbarWnd*)GetProp(hWnd, TEXT("toolbar_this"));
		if(pThis && pThis->m_hWnd != hWnd)
		{
			pThis = NULL;
		}
	}

	if(pThis || uMessage == WM_CREATE)
	{
		switch (uMessage)
		{
		case WM_EDIT_CAPTURE:
			if (wParam)
			{
				SetCapture(hWnd);
				pThis->m_inCapture = TRUE;
			}
			else
			{
				ReleaseCapture();
				pThis->m_inCapture = FALSE;
			}
			break;
		case WM_EDIT_ACTIONKEY:
			switch (wParam)
			{
			case VK_RETURN:
				{
					std::wstring url = pThis->m_omnibox->get_url();
					pThis->m_omnibox->select_all();
					pThis->m_parent->open(url.c_str());
				}
				break;
			}
			return 0;
		case WM_OMNIBOX_CLICKED:
			pThis->OnOmniboxClicked();
			break;
		case WM_UPDATE_CONTROL:
			{
				LPRECT rcDraw = (LPRECT)lParam;
				InvalidateRect(hWnd, rcDraw, FALSE);
			}
			break;
		case WM_SETCURSOR:
			pThis->update_cursor();
			break;
		case WM_ERASEBKGND:
			return TRUE;
		case WM_CREATE:
			{
				LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
				pThis = (CToolbarWnd*)(lpcs->lpCreateParams);
				SetProp(hWnd, TEXT("toolbar_this"), (HANDLE) pThis);
				pThis->m_hWnd = hWnd;
				pThis->OnCreate();
			}
			break;
		case WM_PAINT:
			{
				PAINTSTRUCT ps;
				HDC hdc = BeginPaint(hWnd, &ps);

				simpledib::dib dib;

				dib.beginPaint(hdc, &ps.rcPaint);
				pThis->OnPaint(&dib, &ps.rcPaint);
				dib.endPaint();

				EndPaint(hWnd, &ps);
			}
			return 0;
		case WM_KILLFOCUS:
			if (pThis->m_omnibox && pThis->m_omnibox->have_focus())
			{
				pThis->m_omnibox->KillFocus();
			}
			break;
		case WM_SIZE:
			pThis->OnSize(LOWORD(lParam), HIWORD(lParam));
			return 0;
		case WM_DESTROY:
			RemoveProp(hWnd, TEXT("toolbar_this"));
			pThis->OnDestroy();
			delete pThis;
			return 0;
		case WM_MOUSEMOVE:
			{
				TRACKMOUSEEVENT tme;
				ZeroMemory(&tme, sizeof(TRACKMOUSEEVENT));
				tme.cbSize = sizeof(TRACKMOUSEEVENT);
				tme.dwFlags		= TME_QUERY;
				tme.hwndTrack	= hWnd;
				TrackMouseEvent(&tme);
				if(!(tme.dwFlags & TME_LEAVE))
//.........这里部分代码省略.........
开发者ID:Grimace1975,项目名称:litebrowser,代码行数:101,代码来源:ToolbarWnd.cpp

示例13: switch

//--------------------------------------------------------------------------------------
// Desc:
//--------------------------------------------------------------------------------------
LRESULT CD3DArcBall::HandleMessages( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
    // Current mouse position
    int iMouseX = (short)LOWORD(lParam);
    int iMouseY = (short)HIWORD(lParam);

    switch( uMsg )
    {
        case WM_LBUTTONDOWN:
        case WM_LBUTTONDBLCLK:
            SetCapture( hWnd );
            OnBegin( iMouseX, iMouseY );
            return TRUE;

        case WM_LBUTTONUP:
            ReleaseCapture();
            OnEnd();
            return TRUE;

        case WM_RBUTTONDOWN:
        case WM_RBUTTONDBLCLK:
        case WM_MBUTTONDOWN:
        case WM_MBUTTONDBLCLK:
            SetCapture( hWnd );
            // Store off the position of the cursor when the button is pressed
            m_ptLastMouse.x = iMouseX;
            m_ptLastMouse.y = iMouseY;
            return TRUE;

        case WM_RBUTTONUP:
        case WM_MBUTTONUP:
            ReleaseCapture();
            return TRUE;

        case WM_MOUSEMOVE:
            if( MK_LBUTTON&wParam )
            {
                OnMove( iMouseX, iMouseY );
				g_bRequestRender = TRUE;
            }
            else if( (MK_RBUTTON&wParam) || (MK_MBUTTON&wParam) )
            {
                // Normalize based on size of window and bounding sphere radius
                FLOAT fDeltaX = ( m_ptLastMouse.x-iMouseX ) * m_fRadiusTranslation / m_nWidth;
                FLOAT fDeltaY = ( m_ptLastMouse.y-iMouseY ) * m_fRadiusTranslation / m_nHeight;

                if( wParam & MK_RBUTTON )
                {
					if ( GetKeyState(VK_LSHIFT) == 0 )
					{
	                    D3DXMatrixTranslation( &m_mTranslationDelta, -1*fDeltaX, 1*fDeltaY, 0.0f );
		                D3DXMatrixMultiply( &m_mTranslation, &m_mTranslation, &m_mTranslationDelta );
					}
					else
					{
						D3DXMatrixTranslation( &m_mTranslationDelta, 0.0f, 0.0f, 5*fDeltaY );
						D3DXMatrixMultiply( &m_mTranslation, &m_mTranslation, &m_mTranslationDelta );
					}
                }

                // Store mouse coordinate
                m_ptLastMouse.x = iMouseX;
                m_ptLastMouse.y = iMouseY;
				
				g_bRequestRender = TRUE;
            }
            return TRUE;
    }

    return FALSE;
}
开发者ID:AnthonyNystrom,项目名称:GenXSource,代码行数:74,代码来源:d3dutil.cpp

示例14: STRICT_REQUIRE

LRESULT CALLBACK Win32ScreenDevice::WindowProc(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam)
{
  STRICT_REQUIRE ( g_win32ScreenDev != 0 );
  switch ( Msg )
  {
  case XEVENT:
    break;
  case WM_SIZE:
    if ( g_win32ScreenDev->attached_ ) g_win32ScreenDev->OnResize();
    break;
  case WM_CREATE:
    mouse_locked = false;
    ReleaseCapture();
    break;
  case WM_ACTIVATE:
    if ( LOWORD(wParam) != WA_INACTIVE )
      g_win32ScreenDev->isActive_ = true;
    else
      g_win32ScreenDev->isActive_ = false;
    g_win32ScreenDev->EnqueEvent(EVENT::MakeWindowActive(g_win32ScreenDev->isActive_));
    break;
  case WM_CLOSE:
    if (!g_win32ScreenDev->attached_)
    {
      PostMessage(hWnd,XCLOSE,0,0);
      return 0;
    }
    break;
  case WM_SETCURSOR:
    if(HTCLIENT == LOWORD(lParam))
    {
      if ( g_win32ScreenDev->enableCursor_ )
        SetCursor(g_win32ScreenDev->cursor_);
      else
        SetCursor(0);
      return TRUE;
    }
    break;
  case WM_PAINT:
    g_win32ScreenDev->MakeRubbish();
    if ( g_win32ScreenDev->attached_ )
      g_win32ScreenDev->OnPaint();
    break;
  case WM_GETDLGCODE:
    {
      if ( lParam && ((MSG*)lParam)->message == WM_KEYDOWN )
      {
        EVENT e = g_win32ScreenDev->ProcessMessage(*(MSG*)lParam);
        if ( e.type != EVENT::NONE )
          g_win32ScreenDev->EnqueEvent(e);
        return DLGC_WANTALLKEYS;
      }
      else
        return DLGC_WANTALLKEYS;
    }

  default:
    {
      MSG msg;
      msg.message = Msg;
      msg.lParam  = lParam;
      msg.wParam  = wParam;
      EVENT e = g_win32ScreenDev->ProcessMessage(msg);
      if ( e.type != EVENT::NONE )
        g_win32ScreenDev->EnqueEvent(e);
    }
  }
  return
    (defproc_ ? defproc_ : DefWindowProc)(hWnd,Msg,wParam,lParam);
}
开发者ID:alexeysudachen,项目名称:spritecraft-legacy,代码行数:70,代码来源:m_win32wnd.cpp

示例15: UNREFERENCED_PARAMETER

//--------------------------------------------------------------------------------------
// Call this from your message proc so this class can handle window messages
//--------------------------------------------------------------------------------------
LRESULT CBaseCamera::HandleMessages( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
    UNREFERENCED_PARAMETER( hWnd );
    UNREFERENCED_PARAMETER( lParam );

    switch( uMsg )
    {
        case WM_KEYDOWN:
        {
            // Map this key to a D3DUtil_CameraKeys enum and update the
            // state of m_aKeys[] by adding the KEY_WAS_DOWN_MASK|KEY_IS_DOWN_MASK mask
            // only if the key is not down
            D3DUtil_CameraKeys mappedKey = MapKey( (UINT)wParam );
            if( mappedKey != CAM_UNKNOWN )
            {
                if( FALSE == IsKeyDown(m_aKeys[mappedKey]) )
                    m_aKeys[ mappedKey ] = KEY_WAS_DOWN_MASK | KEY_IS_DOWN_MASK;
            }
            break;
        }

        case WM_KEYUP:
        {
            // Map this key to a D3DUtil_CameraKeys enum and update the
            // state of m_aKeys[] by removing the KEY_IS_DOWN_MASK mask.
            D3DUtil_CameraKeys mappedKey = MapKey( (UINT)wParam );
            if( mappedKey != CAM_UNKNOWN )
                m_aKeys[ mappedKey ] &= ~KEY_IS_DOWN_MASK;
            break;
        }

        case WM_RBUTTONDOWN:
        case WM_MBUTTONDOWN:
        case WM_LBUTTONDOWN:
        case WM_RBUTTONDBLCLK:
        case WM_MBUTTONDBLCLK:
        case WM_LBUTTONDBLCLK:
        {
            // Compute the drag rectangle in screen coord.
            POINT ptCursor = { (short)LOWORD(lParam), (short)HIWORD(lParam) };

            // Update member var state
            if( ( uMsg == WM_LBUTTONDOWN || uMsg == WM_LBUTTONDBLCLK ) && PtInRect( &m_rcDrag, ptCursor ) )
                { m_bMouseLButtonDown = true; m_nCurrentButtonMask |= MOUSE_LEFT_BUTTON; }
            if( ( uMsg == WM_MBUTTONDOWN || uMsg == WM_MBUTTONDBLCLK ) && PtInRect( &m_rcDrag, ptCursor ) )
                { m_bMouseMButtonDown = true; m_nCurrentButtonMask |= MOUSE_MIDDLE_BUTTON; }
            if( ( uMsg == WM_RBUTTONDOWN || uMsg == WM_RBUTTONDBLCLK ) && PtInRect( &m_rcDrag, ptCursor ) )
                { m_bMouseRButtonDown = true; m_nCurrentButtonMask |= MOUSE_RIGHT_BUTTON; }

            // Capture the mouse, so if the mouse button is 
            // released outside the window, we'll get the WM_LBUTTONUP message
            SetCapture(hWnd);
            GetCursorPos( &m_ptLastMousePosition );
            return TRUE;
        }

        case WM_RBUTTONUP: 
        case WM_MBUTTONUP: 
        case WM_LBUTTONUP:   
        {
            // Update member var state
            if( uMsg == WM_LBUTTONUP ) { m_bMouseLButtonDown = false; m_nCurrentButtonMask &= ~MOUSE_LEFT_BUTTON; }
            if( uMsg == WM_MBUTTONUP ) { m_bMouseMButtonDown = false; m_nCurrentButtonMask &= ~MOUSE_MIDDLE_BUTTON; }
            if( uMsg == WM_RBUTTONUP ) { m_bMouseRButtonDown = false; m_nCurrentButtonMask &= ~MOUSE_RIGHT_BUTTON; }

            // Release the capture if no mouse buttons down
            if( !m_bMouseLButtonDown  && 
                !m_bMouseRButtonDown &&
                !m_bMouseMButtonDown )
            {
                ReleaseCapture();
            }
            break;
        }

        case WM_MOUSEWHEEL: 
            // Update member var state
            m_nMouseWheelDelta = (short)HIWORD(wParam) / 120;
            break;
    }

    return FALSE;
}
开发者ID:AnthonyNystrom,项目名称:GenXSource,代码行数:86,代码来源:d3dutil.cpp


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