Пример #1
0
void CMiniMule::OnDestroy()
{
    TRACE("%s\n", __FUNCTION__);
    ASSERT( GetCurrentThreadId() == _uMainThreadId );
    ASSERT( m_iInCallback == 0 );
    KillAutoCloseTimer();
    CDHtmlDialog::OnDestroy();
}
Пример #2
0
void CMiniMule::RestoreMainWindow()
{
    if (theApp.emuledlg->IsRunning() && !theApp.emuledlg->IsWindowVisible())
    {
        if (!theApp.emuledlg->IsPreferencesDlgOpen())
        {
            KillAutoCloseTimer();
            m_bRestoreMainWnd = true;
            PostMessage(WM_CLOSE);
        }
        else
            MessageBeep(MB_OK);
    }
}
Пример #3
0
HRESULT CMiniMule::OnOptions(IHTMLElement* pElement)
{
	CCounter cc(m_iInCallback);
	if (theApp.emuledlg->IsRunning())
	{
		// showing the 'Pref' dialog will process the message queue -> timer messages will be dispatched -> kill auto close timer!
		KillAutoCloseTimer();
		if (theApp.emuledlg->ShowPreferences() == -1)
			MessageBeep(MB_OK);
		if (GetAutoClose())
			CreateAutoCloseTimer();
	}
	return S_OK;
}
Пример #4
0
HRESULT CMiniMule::OnRestoreMainWindow(IHTMLElement* pElement)
{
	CCounter cc(m_iInCallback);
	if (theApp.emuledlg->IsRunning() && !theApp.emuledlg->IsWindowVisible())
	{
		if (!theApp.emuledlg->IsPreferencesDlgOpen())
		{
			KillAutoCloseTimer();
			m_bRestoreMainWnd = true;
			PostMessage(WM_CLOSE);
		}
		else
			MessageBeep(MB_OK);
	}
	return S_OK;
}
Пример #5
0
void CMiniMule::OnClose()
{
	ASSERT( m_iInCallback == 0 );
	KillAutoCloseTimer();

	if (GetAutoClose())
	{
		BOOL (WINAPI *pfnAnimateWindow)(HWND hWnd, DWORD dwTime, DWORD dwFlags);
		(FARPROC&)pfnAnimateWindow = GetProcAddress(GetModuleHandle(_T("user32")), "AnimateWindow");
		if (pfnAnimateWindow)
			(*pfnAnimateWindow)(m_hWnd, 200, AW_HIDE | AW_BLEND | AW_CENTER);
	}

	CDHtmlDialog::OnClose();
	theApp.emuledlg->PostMessage(UM_CLOSE_MINIMULE, (WPARAM)m_bRestoreMainWnd);
}
Пример #6
0
void CMiniMule::OnTimer(UINT nIDEvent)
{
	if (m_bAutoClose && nIDEvent == m_uAutoCloseTimer)
	{
		KillAutoCloseTimer();

		CPoint pt;
		GetCursorPos(&pt);
		CRect rcWnd;
		GetWindowRect(&rcWnd);
		if (!rcWnd.PtInRect(pt))
			PostMessage(WM_CLOSE);
		else
			CreateAutoCloseTimer();
	}
	CDHtmlDialog::OnTimer(nIDEvent);
}
Пример #7
0
void CMiniMule::OnClose()
{
    TRACE("%s\n", __FUNCTION__);
    ASSERT( GetCurrentThreadId() == _uMainThreadId );
    ASSERT( m_iInCallback == 0 );
    KillAutoCloseTimer();

    if (GetAutoClose())
    {
        BOOL (WINAPI *pfnAnimateWindow)(HWND hWnd, DWORD dwTime, DWORD dwFlags);
        (FARPROC&)pfnAnimateWindow = GetProcAddress(GetModuleHandle(_T("user32")), "AnimateWindow");
        if (pfnAnimateWindow)
            (*pfnAnimateWindow)(m_hWnd, 200, AW_HIDE | AW_BLEND | AW_CENTER);
    }

    CDHtmlDialog::OnClose();

    ///////////////////////////////////////////////////////////////////////////
    // Destroy the MiniMule window

    // Solution #1: Posting a close-message to main window (can not be done with 'SendMessage') may
    // create message queue sync. problems when having high system load.
    //theApp.emuledlg->PostMessage(UM_CLOSE_MINIMULE, (WPARAM)m_bRestoreMainWnd);

    // Solution #2: 'DestroyModeless' -- posts a 'destroy' message to 'this' which will have a very
    // similar effect (and most likely problems) than using PostMessage(<main-window>).
    //DestroyModeless();

    // Solution #3: 'DestroyWindow' -- destroys the window and *deletes* 'this'. On return of
    // 'DestroyWindow' the 'this' is no longer valid! However, this should be safe because MFC
    // is also using the same 'technique' for several window classes.
    theApp.emuledlg->m_pMiniMule = NULL;
    bool bRestoreMainWnd = m_bRestoreMainWnd;
    DestroyWindow();
    //NOTE: 'this' IS NO LONGER VALID!
    if (bRestoreMainWnd)
        theApp.emuledlg->RestoreWindow();
}
Пример #8
0
void CMiniMule::OnDestroy()
{
	ASSERT( m_iInCallback == 0 );
	KillAutoCloseTimer();
	CDHtmlDialog::OnDestroy();
}