Beispiel #1
0
void CAlertDlg::OnDocumentComplete(LPDISPATCH pDisp, LPCTSTR szUrl)
{
TRY_CATCH

	CDHtmlDialogEx::OnDocumentComplete(pDisp, szUrl);

	if(IsPageLoaded() == TRUE)
	{	
		//
		//	We give an option for the derived dialog to perfom some actions like update GUI here
		//
		OnPageLoaded();
		//
		//
		//	We need to calculate the position of the Next Alert 	
		//
		
		RECT rc;
		WINDOWPOS posc;
		CalcluateAlertPosition(&rc, &posc);
		//
		//	We need this stuff for parent transparent window
		//
		if(m_hWndParent)
		{
			::SendMessage(m_hWndParent,WM_WINDOWPOSCHANGING,NULL,(LPARAM)&posc);
			CTransparentWindow::OnUserMove(this->m_hWndParent ,&rc);
		}
		//
		//
		//if( m_hWndParent )
		//	::SendMessage(m_hWndParent,WM_USER_BORDER_MOVE,NULL,(LPARAM)&rc);
		if(m_hWndParent)
			::ShowWindow(this->m_hWndParent,SW_SHOWNORMAL);

		//SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER );
	    SetWindowPos(NULL, posc.x, posc.y, posc.cx, posc.cy, SWP_NOZORDER | SWP_NOACTIVATE | SWP_DRAWFRAME);
		//UpdateWindow();
		//

		//
		//  FADEIN/FAEOUT effect without 1/2-transparent border	
		//	
		m_layeredWnd.AddLayeredStyle(this->m_hWnd);			// Prepeare window to make it transparent
		m_iCurrentTransparency = BALLON_START_TRNSPARENCY;
		MakeWindowTransparent(m_iCurrentTransparency);
		SetTimer(BALLOON_NEW_FIDEIN_TIMER, BALLOON_NEW_FIDEIN_TIMEOUT, NULL);
 		SetTimer(BALLOON_CLOSEDOWN_TIMER, BALLOON_CLOSEDOWN_TIMEOUT, NULL);
		SetTimer(BALLOON_MOUSEOUT_WAIT_FADEOUT_TIMER, BALLOON_MOUSEOUT_WAIT_FADEOUT_TIMEOUT, NULL);

		// SetForegroundWindowEx may be called to fix some issue STL-679 
		SetForegroundWindowEx();

		ShowWindow(SW_NORMAL);
	}

CATCH_LOG(_T("CAlertDlg::OnDocumentComplete"))
}
Beispiel #2
0
void raiseWindow(QWidget *w)
{
    /* Maybe Qt will become agressive enough one day that
     * this is enough on windows too*/
    w->raise();
#ifdef Q_OS_WIN
    /* In the meantime we do our own attention grabbing */
    if (!SetForegroundWindow((HWND)w->winId()) &&
            !SetForegroundWindowEx((HWND)w->winId()))  {
        OutputDebugString("SetForegroundWindow (ex) failed");
        /* Yet another fallback which will not work on some
         * versions and is not recommended by msdn */
        if (!ShowWindow((HWND)w->winId(), SW_SHOWNORMAL)) {
            OutputDebugString("ShowWindow failed.");
        }
    }
#endif
}
Beispiel #3
0
ResultType WinGroup::Deactivate(bool aStartWithMostRecent)
{
	if (IsEmpty())
		return OK;  // OK since this is the expected behavior in this case.
	// Otherwise:
	if (!Update(false)) // Update our private member vars.
		return FAIL;  // It already displayed the error for us.

	HWND active_window = GetForegroundWindow();
	if (IsMember(active_window, *g))
		sAlreadyVisitedCount = 0;

	// Activate the next unvisited non-member:
	WindowSearch ws;
	ws.mFindLastMatch = !aStartWithMostRecent || sAlreadyVisitedCount;
	ws.mAlreadyVisited = sAlreadyVisited;
	ws.mAlreadyVisitedCount = sAlreadyVisitedCount;
	ws.mFirstWinSpec = mFirstWindow;

	EnumWindows(EnumParentFindAnyExcept, (LPARAM)&ws);

	if (ws.mFoundParent)
	{
		// If the window we're about to activate owns other visble parent windows, it can
		// never truly be activated because it must always be below them in the z-order.
		// Thus, instead of activating it, activate the first (and usually the only?)
		// visible window that it owns.  Doing this makes things nicer for some apps that
		// have a pair of main windows, such as MS Visual Studio (and probably many more),
		// because it avoids activating such apps twice in a row as the user progresses
		// through the sequence:
		HWND first_visible_owned = WindowOwnsOthers(ws.mFoundParent);
		if (first_visible_owned)
		{
			MarkAsVisited(ws.mFoundParent);  // Must mark owner as well as the owned window.
			// Activate the owned window instead of the owner because it usually
			// (probably always, given the comments above) is the real main window:
			ws.mFoundParent = first_visible_owned;
		}
		SetForegroundWindowEx(ws.mFoundParent);
		// Probably best to do this before WinDelay in case another hotkey fires during the delay:
		MarkAsVisited(ws.mFoundParent);
		DoWinDelay;
	}
	else // No window was found to activate (they have all been visited).
	{
		if (sAlreadyVisitedCount)
		{
			bool wrap_around = (sAlreadyVisitedCount > 1);
			sAlreadyVisitedCount = 0;
			if (wrap_around)
			{
				// The user pressed a hotkey to do something, yet nothing has happened yet.
				// We want something to happen every time if there's a qualifying
				// "something" that we can do.  And in this case there is: we can start
				// over again through the list, excluding the foreground window (which
				// the user has already had a chance to review):
				MarkAsVisited(active_window);
				// Make a recursive call to self.  This can't result in an infinite
				// recursion (stack fault) because the called layer will only
				// recurse a second time if sAlreadyVisitedCount > 1, which is
				// impossible with the current logic:
				Deactivate(false); // Seems best to ignore aStartWithMostRecent in this case?
			}
		}
	}
	// Even if a window wasn't found, we've done our job so return OK:
	return OK;
}