Пример #1
0
bool CToolBarPopup::ShowPopup( UINT nFlags, CPoint pt, CRect& rcExclude )
{
    CWinAppEx* pApp = CWinAppEx::GetInstance();
    CString strWndClass = AfxRegisterWndClass( CS_SAVEBITS | ( pApp->IsWinXP() ? CS_DROPSHADOW : 0 ),
        ::LoadCursor( 0, IDC_ARROW ), ( HBRUSH )( COLOR_MENU + 1 ), 0 );

    if ( !CreateEx( m_bFlatMenu ? ( WS_EX_TOOLWINDOW | WS_EX_TOPMOST ) : WS_EX_PALETTEWINDOW, strWndClass, 0,
            WS_POPUP | WS_CLIPSIBLINGS | WS_OVERLAPPED | ( m_bFlatMenu ? WS_BORDER : ( WS_DLGFRAME | WS_CLIPCHILDREN ) ),
            CRect( 0, 0, 0, 0 ), 0, 0 ) )
    {
        return false;
    }

    SetPosition( nFlags, pt, rcExclude );
    SetCapture();
    SendMessage( WM_SETCURSOR, ( WPARAM )m_hWnd, MAKELPARAM( HTCLIENT, 0 ) );

    m_pPopup = this;
    m_hKeyboardHook = ::SetWindowsHookEx( WH_KEYBOARD, KeyboardProc, 0, ::GetCurrentThreadId() );
    ASSERT( m_hKeyboardHook != 0 );

    // Emulate menu loop
    RunModalLoop( MLF_NOKICKIDLE );

    VERIFY( ::UnhookWindowsHookEx( m_hKeyboardHook ) );
    m_hKeyboardHook = 0;
    m_pPopup = 0;

    DestroyWindow();

    return true;
}
Пример #2
0
int CPopupCombo::DoModal()
{
	static const int	DROPDOWN_HEIGHT = 100;
	int	retc = IDABORT;
	m_MouseHook = SetWindowsHookEx(WH_MOUSE, MouseProc, 
		AfxGetApp()->m_hInstance, AfxGetApp()->m_nThreadID);
	if (m_MouseHook != NULL) {
		CString	Text;
		OnBeginEdit(Text);
		CRect	r;
		if (m_Rect != NULL)	// if ctor was passed a rect, use it
			r = *m_Rect;
		else	// otherwise use parent's client rect
			m_Parent->GetClientRect(r);
		// create the edit control
		r.OffsetRect(1, -2);	// fudge to line up with grid control
		r.bottom += DROPDOWN_HEIGHT;	// expand to include drop list
		if (Create(m_Style, r, m_Parent, 0)) {
			PostMessage(CB_SHOWDROPDOWN, TRUE);	// show drop list
			// set font to parent's font
			SetFont(m_Parent->GetFont());
			for (int i = 0; i < m_ComboStr.GetSize(); i++)
				AddString(m_ComboStr[i]);
			m_OrigSel = SelectString(-1, Text);
			SetFocus();
			retc = RunModalLoop();
			DestroyWindow();
		}
		UnhookWindowsHookEx(m_MouseHook);
		m_MouseHook = NULL;
	}
    return(retc);
}
Пример #3
0
bool CSortingOptionsPopup::Create()
{
	UINT class_style= CS_SAVEBITS | (WhistlerLook::IsAvailable() ? CS_DROPSHADOW : 0);

	if (!CreateEx(WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST,
		AfxRegisterWndClass(class_style, ::LoadCursor(NULL, IDC_ARROW)), 0,
		WS_POPUP | WS_VISIBLE | WS_CLIPCHILDREN | MFS_SYNCACTIVE, CRect(0,0,1,1), AfxGetMainWnd()))
		return false;

	if (!dlg_options_.Create(this))
		return false;

	CRect rect;
	dlg_options_.GetWindowRect(rect);

	SetWindowPos(0, left_top_.x, left_top_.y, rect.Width(), rect.Height(), SWP_NOZORDER);

	ShowWindow(SW_SHOW);

	RunModalLoop();

	DestroyWindow();

	delete this;

	return true;
}
Пример #4
0
BOOL CXTPPopupControl::ShowModal(CWnd* pParent)
{
	CWinApp* pApp = AfxGetApp();
	if (pApp != NULL)
		pApp->EnableModeless(FALSE);

	HWND hWndTop = 0;
#if (_MSC_VER <= 1100)
	CWnd* pParentWnd = CWnd::GetSafeOwner(pParent, &hWndTop);
	HWND hWndParent = pParentWnd->GetSafeHwnd();
#else
	HWND hWndParent = CWnd::GetSafeOwner_(pParent->GetSafeHwnd(), &hWndTop);
#endif


	BOOL bEnableParent = FALSE;
	if (hWndParent != NULL && ::IsWindowEnabled(hWndParent))
	{
		::EnableWindow(hWndParent, FALSE);
		bEnableParent = TRUE;
	}


	//create popup wnd
	if (Show(pParent))
	{
		SetFocus();

		RunModalLoop(MLF_NOIDLEMSG | MLF_NOKICKIDLE);
	}

	if (bEnableParent)
		::EnableWindow(hWndParent, TRUE);
	if (hWndParent != NULL && ::GetActiveWindow() == m_hWnd)
		::SetActiveWindow(hWndParent);

	DestroyWindow();

	// re-enable windows
	if (::IsWindow(hWndTop))
		::EnableWindow(hWndTop, TRUE);
	hWndTop = NULL;
	if (pApp != NULL)
		pApp->EnableModeless(TRUE);


	return TRUE;
}
Пример #5
0
bool TaggingPopup::Create(CWnd* parent, const VectPhotoInfo& photos)
{
	UINT class_style= CS_SAVEBITS | (WhistlerLook::IsAvailable() ? CS_DROPSHADOW : 0);

	if (!CreateEx(WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST,
		AfxRegisterWndClass(class_style, ::LoadCursor(NULL, IDC_ARROW)), 0,
		WS_POPUP | WS_VISIBLE | WS_CLIPCHILDREN | MFS_SYNCACTIVE, CRect(0,0,1,1), parent))
		return false;

	if (!tag_wnd_.Create(this))
		return false;

	close_wnd_.Create(this, false);
	CRect bar_rect;
	close_wnd_.GetWindowRect(bar_rect);

	tag_wnd_.PhotosSelected(photos);

	CSize ideal= tag_wnd_.GetIdealSize();
	ideal.cx = std::min<int>(400, ideal.cx);	// sanity limits
	ideal.cy = std::min<int>(750, ideal.cy);

	int top= bar_rect.Height() - 4;

	tag_wnd_.MoveWindow(0, top, ideal.cx, ideal.cy);

	int width= ideal.cx;
	int height= top + ideal.cy;

	CRect wnd(left_top_, CSize(width, height));
	::RectToWorkArea(wnd, false);

	SetWindowPos(0, wnd.left, wnd.top, wnd.Width(), wnd.Height(), SWP_NOZORDER);

	close_wnd_.SetWindowPos(0, width - bar_rect.Width(), 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);

	ShowWindow(SW_SHOW);

	RunModalLoop();

	DestroyWindow();

	delete this;

	return true;
}
Пример #6
0
int CDialog::DoModal()
{
	// can be constructed with a resource template or InitModalIndirect
	ASSERT(m_lpszTemplateName != NULL || m_hDialogTemplate != NULL ||
		m_lpDialogTemplate != NULL);

	// load resource as necessary
	LPCDLGTEMPLATE lpDialogTemplate = m_lpDialogTemplate;
	HGLOBAL hDialogTemplate = m_hDialogTemplate;
	HINSTANCE hInst = AfxGetResourceHandle();
	if (m_lpszTemplateName != NULL)
	{
		hInst = AfxFindResourceHandle(m_lpszTemplateName, RT_DIALOG);
		HRSRC hResource = ::FindResource(hInst, m_lpszTemplateName, RT_DIALOG);
		hDialogTemplate = LoadResource(hInst, hResource);
	}
	if (hDialogTemplate != NULL)
		lpDialogTemplate = (LPCDLGTEMPLATE)LockResource(hDialogTemplate);

	// return -1 in case of failure to load the dialog template resource
	if (lpDialogTemplate == NULL)
		return -1;

	// disable parent (before creating dialog)
	HWND hWndParent = PreModal();
	AfxUnhookWindowCreate();
	BOOL bEnableParent = FALSE;
	if (hWndParent != NULL && ::IsWindowEnabled(hWndParent))
	{
		::EnableWindow(hWndParent, FALSE);
		bEnableParent = TRUE;
	}

	TRY
	{
		// create modeless dialog
		AfxHookWindowCreate(this);
		if (CreateDlgIndirect(lpDialogTemplate,
						CWnd::FromHandle(hWndParent), hInst))
		{
			if (m_nFlags & WF_CONTINUEMODAL)
			{
				// enter modal loop
				DWORD dwFlags = MLF_SHOWONIDLE;
				if (GetStyle() & DS_NOIDLEMSG)
					dwFlags |= MLF_NOIDLEMSG;
				VERIFY(RunModalLoop(dwFlags) == m_nModalResult);
			}

			// hide the window before enabling the parent, etc.
			if (m_hWnd != NULL)
				SetWindowPos(NULL, 0, 0, 0, 0, SWP_HIDEWINDOW|
					SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER);
		}
	}
	CATCH_ALL(e)
	{
		DELETE_EXCEPTION(e);
		m_nModalResult = -1;
	}
	END_CATCH_ALL

	if (bEnableParent)
		::EnableWindow(hWndParent, TRUE);
	if (hWndParent != NULL && ::GetActiveWindow() == m_hWnd)
		::SetActiveWindow(hWndParent);

	// destroy modal window
	DestroyWindow();
	PostModal();

	// unlock/free resources as necessary
	if (m_lpszTemplateName != NULL || m_hDialogTemplate != NULL)
		UnlockResource(hDialogTemplate);
	if (m_lpszTemplateName != NULL)
		FreeResource(hDialogTemplate);

	return m_nModalResult;
}
Пример #7
0
int CRuntimeDlg::DoModal(LPCTSTR szCaption, DWORD dwStyle, DWORD dwExStyle, const CRect& rect, CWnd* pParentWnd, UINT nID)
{
	// fail immediately if no controls have been added
	if (!m_lstControls.GetCount())
		return IDCANCEL;
	
	// setup for modal loop and creation
	m_nModalResult = -1;
	m_nFlags |= WF_CONTINUEMODAL;
	
	// disable parent (before creating dialog)
	HWND hWndParent = PreModal();
	AfxUnhookWindowCreate();
	
	BOOL bEnableParent = FALSE;
	if (hWndParent != NULL && ::IsWindowEnabled(hWndParent))
	{
		::EnableWindow(hWndParent, FALSE);
		bEnableParent = TRUE;
	}
	
	try
	{
		// create modeless dialog
		if (Create(szCaption, dwStyle, dwExStyle, rect, pParentWnd ? pParentWnd : CWnd::FromHandle(hWndParent), nID))
		{
			if (m_nFlags & WF_CONTINUEMODAL)
			{
				// enter modal loop
				DWORD dwFlags = MLF_SHOWONIDLE;
				if (GetStyle() & DS_NOIDLEMSG)
					dwFlags |= MLF_NOIDLEMSG;
				VERIFY(RunModalLoop(dwFlags) == m_nModalResult);
			}
			
			// hide the window before enabling the parent, etc.
			if (m_hWnd != NULL)
				SetWindowPos(NULL, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
		}
	}
	catch(...)
	{
		m_nModalResult = -1;
	}
	
	if (bEnableParent)
		::EnableWindow(hWndParent, TRUE);
	
	if (hWndParent != NULL && ::GetActiveWindow() == m_hWnd)
		::SetActiveWindow(hWndParent);
	
	// save pos
	SaveCurrentPos();

	// destroy modal window
	DestroyWindow();
	PostModal();

	// cleanup resources
	GraphicsMisc::VerifyDeleteObject(m_hFont);
	::DestroyIcon(m_hILarge);
	::DestroyIcon(m_hISmall);
	
	return m_nModalResult;
}
Пример #8
0
int CWebInterfaceDlg::DoModal() 
{
		
	ASSERT(m_lpszTemplateName != NULL || m_hDialogTemplate != NULL ||
		m_lpDialogTemplate != NULL);

	
	LPCDLGTEMPLATE lpDialogTemplate = m_lpDialogTemplate;
	HGLOBAL hDialogTemplate = m_hDialogTemplate;
	HINSTANCE hInst = AfxGetResourceHandle();
	if (m_lpszTemplateName != NULL)
	{
		hInst = AfxFindResourceHandle(m_lpszTemplateName, RT_DIALOG);
		HRSRC hResource = ::FindResource(hInst, m_lpszTemplateName, RT_DIALOG);
		hDialogTemplate = LoadResource(hInst, hResource);
	}
	if (hDialogTemplate != NULL)
		lpDialogTemplate = (LPCDLGTEMPLATE)LockResource(hDialogTemplate);

	
	if (lpDialogTemplate == NULL)
		return -1;

	
	HWND hWndParent = PreModal();
	AfxUnhookWindowCreate();
	BOOL bEnableParent = FALSE;
	if (hWndParent != NULL && ::IsWindowEnabled(hWndParent))
	{
		::EnableWindow(hWndParent, FALSE);
		bEnableParent = TRUE;
	}

	TRY
	{
		
		AfxHookWindowCreate(this);
		if (CreateDlgIndirect(lpDialogTemplate,
						CWnd::FromHandle(hWndParent), hInst))
		{
			if (m_nFlags & WF_CONTINUEMODAL)
			{
				
				DWORD dwFlags = 0; 
				if (GetStyle() & DS_NOIDLEMSG)
					dwFlags |= MLF_NOIDLEMSG;
				VERIFY(RunModalLoop(dwFlags) == m_nModalResult);
			}

			
			if (m_hWnd != NULL)
				SetWindowPos(NULL, 0, 0, 0, 0, SWP_HIDEWINDOW|
					SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER);
		}
	}
	CATCH_ALL(e)
	{
		DELETE_EXCEPTION(e);
		m_nModalResult = -1;
	}
	END_CATCH_ALL

	if (bEnableParent)
		::EnableWindow(hWndParent, TRUE);
	if (hWndParent != NULL && ::GetActiveWindow() == m_hWnd)
		::SetActiveWindow(hWndParent);

	
	DestroyWindow();
	PostModal();

	
	if (m_lpszTemplateName != NULL || m_hDialogTemplate != NULL)
		UnlockResource(hDialogTemplate);
	if (m_lpszTemplateName != NULL)
		FreeResource(hDialogTemplate);

	return m_nModalResult;
}
Пример #9
0
void CHTMLViewCapView::SaveImages(CList<CHTMLViewCapUrl> &lstUrl)
{
	// 
	POSITION pos = NULL;

	// 浏览器和图片的宽度和高度
	DWORD nWidth  = 1024;
	DWORD nHeight = 2048;

	IDispatch *pDoc = NULL;
	IViewObject *pViewObject = NULL;
	VARIANT vUrl;
	VARIANT vUrlName;

	//
	CTime t;
	CString csTime, csDate, csMark1;
	CString csPath;
	CString csFileName;
	HRESULT hr;

	//
	CBitmap *pBM;
	Bitmap *gdiBMP;
	// 用于生成图片的序数
	static DWORD nNum = 0;

	/*
			创建字体
	*/
	HFONT hfont;
	LOGFONT lf;
	ZeroMemory(&lf, sizeof(lf));
	lf.lfHeight   =   0;
	lf.lfWidth    =   0;
	lf.lfEscapement   =   0;
	lf.lfOrientation   =   0;
	lf.lfStrikeOut   =   FALSE;
	lf.lfCharSet   =   DEFAULT_CHARSET;
	lf.lfOutPrecision   =   OUT_DEFAULT_PRECIS;  
	lf.lfClipPrecision   =   CLIP_DEFAULT_PRECIS;  
	lf.lfQuality   =   ANTIALIASED_QUALITY;
	lf.lfPitchAndFamily =   VARIABLE_PITCH;
	lstrcpy(lf.lfFaceName,   _T("微软雅黑"));
	hfont   =   CreateFontIndirect(&lf);

	// 循环遍历所有URL
	for (pos = lstUrl.GetHeadPosition();
		   pos != NULL;
		   lstUrl.GetNext(pos))
	{
		// 获取图片和浏览器分辨率
		nWidth  = lstUrl.GetAt(pos).m_nWidth;
		nHeight = lstUrl.GetAt(pos).m_nHeight;
		CString &csUrl = lstUrl.GetAt(pos).m_csUrl;
		CBitmapDC destDC(nWidth, nHeight);

		// 创建 媒体名称目录
		csPath = ::theApp.m_csImageDir;
		csPath.Append(_T("\\"));
		if (lstUrl.GetAt(pos).m_bHasMediaName) {
			csPath.Append(lstUrl.GetAt(pos).m_csMediaName);
		}  else {
			csPath.Append(lstUrl.GetAt(pos).getMediaNameInUrl());
		}

		::CreateDirectory(csPath, NULL);

		// 创建输出文件路径
		t = CTime::GetCurrentTime();
		csTime = t.Format("\\%H时%M分%S秒-");
		csMark1 = t.Format("%H:%M");
		csDate    = t.Format(" %Y/%m/%d");
		csPath.Append(csTime);

		vUrl.vt = ::VT_BSTR;
		vUrl.bstrVal = (BSTR)csUrl.GetString();  

		m_pBrowserApp->put_Width(nWidth);
		m_pBrowserApp->put_Height(nHeight);

		if (m_pBrowserApp->Navigate2(&vUrl, NULL, NULL, NULL, NULL) == S_OK)
		{
			m_tBeforeEnterLoop = CTime::GetCurrentTime();
			RunModalLoop();
		} else {
			TRACE(_T("%d Document Navigate Failed!\n"), vUrl);
			MessageBox(_T("Navi Error"), _T("Error"), MB_OK);
			return ;
		}
		TRACE("Begin Cap!\n");
		// wait for document to load
		m_pBrowserApp->Refresh();

		// render to enhanced metafile HDC.
		hr = m_pBrowserApp->get_Document(&pDoc);

		if (hr != S_OK) {
			TRACE(_T("%s get_Document failed!\n"), vUrl.bstrVal);
			return ;
		}

		pDoc->QueryInterface(IID_IViewObject, (void**)&pViewObject); // result is first div of document

		if (pDoc == NULL) {
			TRACE(_T("%d query IID_IViewObject failed!\n"), vUrl.bstrVal);
			return ;
		}

		hr = OleDraw(pViewObject, DVASPECT_CONTENT, destDC, NULL);
		if (hr != S_OK) {
			TRACE(_T("%s OleDraw failed!\n"), vUrl.bstrVal);
			return ;
		} 

		/*
				使用字体
		*/
		destDC.SelectObject(hfont);
		destDC.SetTextColor(RGB(0, 0, 0));
		destDC.SetBkColor(RGB(235, 231, 228));
		//destDC.SetBkMode(TRANSPARENT);

        // 输出水印
		TextOut(destDC, nWidth - 70, nHeight - 100, (LPCTSTR)csMark1, csMark1.GetLength()); 
		TextOut(destDC, nWidth - 100, nHeight - 70, (LPCTSTR)csDate, csDate.GetLength()); 
		pBM = destDC.Close();
		gdiBMP = Bitmap::FromHBITMAP(HBITMAP(pBM->GetSafeHandle()), NULL);

		csFileName.Format(_T("%u.jpg"), nNum++);
		csPath.Append(csFileName);
		
		// 保存图片
		gdiBMP->Save(csPath.GetString(), &m_jpegClsid, NULL);
	
		// 清理资源
		delete gdiBMP;
		pBM->DeleteObject();
		pViewObject->Release();
		pDoc->Release();
	}
}
Пример #10
0
bool CDialogRange::getValue(CWnd* pParent, double& fLower, double& fUpper)
{
	int l = 0;
	int t = 0;
	int w = 300;
	int h = 140;
	int ch = 21;		// control's height
	int bw = 80;		// button width

	CString s = AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW, LoadCursor(NULL, IDC_ARROW), CBrush(::GetSysColor(COLOR_BTNFACE)));
	if (!CreateEx(WS_EX_DLGMODALFRAME, s, "Set Graph's Upper && Lower limit", WS_SYSMENU | WS_POPUP | WS_BORDER | WS_CAPTION, l, t, w, h, pParent->GetSafeHwnd(), NULL)) 
		return 0;

	CenterWindow();

	DWORD dwStaticStyles = WS_VISIBLE | WS_CHILD | SS_NOPREFIX | SS_RIGHT;
	DWORD dwEditStyles = WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_AUTOHSCROLL;
	DWORD dwButtonStyles = WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON;

	l = 6;
	t = 6;
	if (!m_cLowerLegend.Create("Lower Limit", dwStaticStyles, CRect(l,t,l+100,t+ch), this)) 
		return false;

	l += 120;
	s.Format("%.2f", fLower);
	if (!m_cLower.CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), s, dwEditStyles, CRect(l,t,l+100,t+ch), this, 1))
		return false;

	l = 6;
	t += ch + 10;
	if (!m_cUpperLegend.Create("Upper Limit", dwStaticStyles, CRect(l,t,l+100,t+ch), this)) 
		return false;

	l += 120;
	s.Format("%.2f", fUpper);
	if (!m_cUpper.CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), s, dwEditStyles, CRect(l,t,l+100,t+ch), this, 2))
		return false;

	l = w / 2 - (bw + 5);
	t += ch + 10;
	if (!m_cOk.Create(_T("OK"), dwButtonStyles, CRect(l, t, l+bw, t+ch), this, IDOK))
		return false;

	l = w / 2 + 5;
	if (!m_cCancel.Create(_T("Cancel"), dwButtonStyles, CRect(l, t, l+bw, t+ch), this, IDCANCEL))
		return false;

	CFont m_Font;
	m_Font.CreatePointFont(80, "MS Sans Serif");

	m_cLowerLegend.SetFont(&m_Font, false);
	m_cUpperLegend.SetFont(&m_Font, false);
	m_cLower.SetFont(&m_Font, false);
	m_cUpper.SetFont(&m_Font, false);
	m_cOk.SetFont(&m_Font, false);
	m_cCancel.SetFont(&m_Font, false);

	ShowWindow(SW_SHOW);

	pParent->EnableWindow(false);
	EnableWindow(true);

	// enter modal loop
	DWORD dwFlags = MLF_SHOWONIDLE;
	if (GetStyle() & DS_NOIDLEMSG)
		dwFlags |= MLF_NOIDLEMSG;

	m_cLower.SetFocus();

	int nRet = RunModalLoop(MLF_NOIDLEMSG);
	if (nRet == IDOK) {
		m_cLower.GetWindowText(s);
		fLower = atof(s);
		m_cUpper.GetWindowText(s);
		fUpper = atof(s);
	}

	if (m_hWnd != NULL)
		SetWindowPos(NULL, 0, 0, 0, 0, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER);

	pParent->SetFocus();
	if (GetParent() != NULL && ::GetActiveWindow() == m_hWnd)
		::SetActiveWindow(pParent->m_hWnd);

	if (::IsWindow(m_hWnd))
		DestroyWindow();

	pParent->EnableWindow(true);

	return true;
}
Пример #11
0
bool CAviReportWnd::DoModal(CAviFile* pAF, bool fHideChecked, bool fShowWarningText)
{
	m_nChunks = 0;
	m_rtDur = 0;

	for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++)
	{
		int cnt = pAF->m_strms[i]->cs2.GetCount();
		if(cnt <= 0) continue;
		CAviFile::strm_t::chunk2& c2 = pAF->m_strms[i]->cs2[cnt-1];
		m_nChunks = max(m_nChunks, c2.n);
		m_rtDur = max(m_rtDur, (REFERENCE_TIME)c2.t<<13);
	}

	CRect r, r2;
	GetDesktopWindow()->GetWindowRect(r);
	r.DeflateRect(r.Width()/4, r.Height()/4);

	LPCTSTR wndclass = AfxRegisterWndClass(
		CS_VREDRAW|CS_HREDRAW|CS_DBLCLKS, 
		AfxGetApp()->LoadStandardCursor(IDC_ARROW), 
		(HBRUSH)(COLOR_BTNFACE + 1), 0);

	CreateEx(0, wndclass, TITLE, WS_POPUPWINDOW|WS_CAPTION|WS_CLIPCHILDREN, r, NULL, 0);

	CRect cr;
	GetClientRect(cr);
	cr.DeflateRect(10, 10);

	SetFont(&m_font, FALSE);

	CDC* pDC = GetDC();
	CFont* pOldFont = pDC->SelectObject(&m_font);

	//

	CString str(
		_T("This AVI file was not prepared for sequential reading, the alternative ")
		_T("'Avi Splitter' will now let the default one handle it. ")
		_T("The complete reinterleaving of this file is strongly recommended before ")
		_T("burning it onto a slow media like cd-rom."));

	r = cr;

	pDC->DrawText(str, r, DT_WORDBREAK|DT_CALCRECT);
	r.right = cr.right;

	m_message.Create(str, WS_CHILD|WS_VISIBLE, r, this);
	m_message.SetFont(&m_font, FALSE);

	//

	r.SetRect(cr.left, r.bottom + 10, cr.right, cr.bottom);

	str = _T("Do not show this dialog again (hold Shift to re-enable it)");

	pDC->DrawText(str, r, DT_WORDBREAK|DT_CALCRECT);
	r.right = cr.right;

	m_checkbox.Create(str, WS_CHILD|WS_VISIBLE|BS_CHECKBOX|BS_AUTOCHECKBOX, r, this, IDC_DONOTSHOWAGAINCHECK);
	m_checkbox.SetFont(&m_font, FALSE);

	CheckDlgButton(IDC_DONOTSHOWAGAINCHECK, fHideChecked?BST_CHECKED:BST_UNCHECKED);

	//

	if(!fShowWarningText)
	{
		m_message.ShowWindow(SW_HIDE);
		m_checkbox.ShowWindow(SW_HIDE);
		r = cr;
	}
	else
	{
		r.SetRect(cr.left, r.bottom + 10, cr.right, cr.bottom);
	}

	m_graph.Create(pAF, r, this);

	//

	pDC->SelectObject(pOldFont);
	ReleaseDC(pDC);

	SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
	SetForegroundWindow();
	ShowWindow(SW_SHOWNORMAL);

	return !!RunModalLoop();
}