本文整理匯總了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
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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); // 查詢光標位置
}
}
示例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);
}
示例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);
}
示例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);
}
示例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
}
}
示例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);
}
示例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);
}
示例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;
}
}
示例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 );
}
}
}
示例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;
}
示例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();
}
}