Esempio n. 1
0
LRESULT CProgressDlg::OnCancel(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{ 
    if(m_ActionOnCancel==CLOSE_MYSELF_AND_PARENT)
    {
        // Hide this window smoothly
        AnimateWindow(m_hWnd, 200, AW_HIDE|AW_BLEND); 

        // Request parent window to close
        HWND hWndParent = ::GetParent(m_hWnd);
        ::PostMessage(hWndParent, WM_CLOSE, 0, 0);
        return 0;
    }
    else if(m_ActionOnCancel==CLOSE_MYSELF)
    {
        // Hide this window smoothly
        AnimateWindow(m_hWnd, 200, AW_HIDE|AW_BLEND); 	  
        return 0;
    }

    // Start cancelling the worker thread
    g_ErrorReportSender.Cancel();  

    // Disable Cancel button
    m_btnCancel.EnableWindow(0);

    return 0;
}
Esempio n. 2
0
LRESULT CProgressDlg::OnCancel(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{ 
	// This method is called when user clicks the "Cancel" button
	// on the dialog.

    if(m_ActionOnCancel==CLOSE_MYSELF_AND_PARENT)
    {
        // Hide this window smoothly
        AnimateWindow(m_hWnd, 200, AW_HIDE|AW_BLEND); 

        // Request parent window to close
        HWND hWndParent = ::GetParent(m_hWnd);
        ::PostMessage(hWndParent, WM_CLOSE, 0, 0);
        return 0;
    }
    else if(m_ActionOnCancel==CLOSE_MYSELF)
    {
        // Hide this window smoothly
        AnimateWindow(m_hWnd, 200, AW_HIDE|AW_BLEND); 	  
        return 0;
    }

    // Start cancelling the worker thread
	CErrorReportSender* pSender = CErrorReportSender::GetInstance();
    pSender->Cancel();  

    // Disable Cancel button
    m_btnCancel.EnableWindow(0);

    return 0;
}
Esempio n. 3
0
void TaskSortFieldSelector::OnShow(WPARAM wParam, LPARAM lParam)
{
	if(wParam && !lParam)
	{
		AnimateWindow(m_hwnd, 300, AW_BLEND);
	}
	else
	{
		AnimateWindow(m_hwnd, 200, AW_BLEND | AW_HIDE);
	}
}
Esempio n. 4
0
void CSplash::OnTimer(UINT_PTR nIDEvent)
{
	// TODO: Add your message handler code here and/or call default
	ShowWindow(SW_HIDE);

	AnimateWindow(300, AW_BLEND);
	Sleep(1000);
	AnimateWindow(300, AW_BLEND | AW_HIDE);
	
 	EndDialog(0);
	CDialogEx::OnTimer(nIDEvent);
}
Esempio n. 5
0
//Window Entry Point
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int nCmdShow)
{
	InitCommonControls();
	HRESULT hr=CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);
	if(SUCCEEDED(hr))
	{
		CoCreateInstance(CLSID_WICImagingFactory,NULL,CLSCTX_INPROC_SERVER,IID_IWICImagingFactory,(LPVOID*)&g_pIWICFactory);
		if(SUCCEEDED(hr))
		{
			MainWindow win;

			win.SetClassName(L"Main");
			//win.SetWindowClassCreate(FALSE);
			win.create_window(L"Main Window");
			AnimateWindow(win.Window(),1000,AW_BLEND);
			MSG msg = { };
			while (GetMessage(&msg, NULL, 0, 0))
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		
		}
		CoUninitialize();
		
	}
	
	
	return 0;
}
Esempio n. 6
0
//CSplashAlpha窗口建立消息函数,对应WM_CREATE
BOOL CSplashWnd::OnCreate(LPCREATESTRUCT lpcs)
{
	//居中渐显窗口
	CenterWindow();
	AnimateWindow(500, AW_BLEND);
	return true;
}
void
HippoAbstractWindow::show(BOOL activate) 
{
    if (showing_)
        return;

#if 0
    g_debug("SIZING: show %p %s",
        window_, HippoUStr(getClassName()).c_str());
#endif

    if (!create())
        return;

    if (animate_)
        AnimateWindow(window_, 400, AW_BLEND);
    else
        ShowWindow(window_, (activate ? SW_RESTORE : SW_SHOWNOACTIVATE));

    if (updateOnShow_) 
        RedrawWindow(window_, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);

    showing_= true;

#if 0
    g_debug("SIZING: visible=%d for %p %s",
        IsWindowVisible(window_),
        window_, HippoUStr(getClassName()).c_str());
#endif
}
Esempio n. 8
0
static int
Win32_AnimateWindow(Jim_Interp *interp, int objc, Jim_Obj *const objv[])
{
    HWND hwnd;
    DWORD dwTime = 0, dwFlags = 0;
    struct map_t { const char* s; DWORD f; };
    
    if (objc != 4) {
        Jim_WrongNumArgs(interp, 1, objv, "windowhandle time flags");
        return JIM_ERR;
    }

    if (Jim_GetLong(interp, objv[1], (long *)&hwnd) != JIM_OK)
        return JIM_ERR;
    if (Jim_GetLong(interp, objv[2], &dwTime) != JIM_OK)
        return JIM_ERR;
    if (GetAnimateWindowFlagsFromObj(interp, objv[3], &dwFlags) != JIM_OK)
        return JIM_ERR;

    if (!AnimateWindow(hwnd, dwTime, dwFlags)) {
        DWORD err = GetLastError();
        Jim_Obj *errObj;
        if (err == ERROR_SUCCESS)
            errObj = Jim_NewStringObj(interp, "error: "
                " calling thread does not own the window", -1);
        else
            errObj = Win32ErrorObj(interp, "AnimateWindow", err);
        Jim_SetResult(interp, errObj);
        return JIM_ERR;
    }
    return JIM_OK;
}
void DLG_GONGJIAOLOU::OnShowWindow(BOOL bShow, UINT nStatus)
{
	AnimateWindow(200, AW_CENTER);  //窗口淡入
	DLG_GONGJIAOLOU::OnPaint();
	CDialogEx::OnShowWindow(bShow, nStatus);
	// TODO: 在此处添加消息处理程序代码
}
Esempio n. 10
0
void CResendDlg::DoHideWindowTimer()
{
    if(!g_CrashInfo.m_bSilentMode)
    {
        AnimateWindow(m_hWnd, 200, AW_HIDE|AW_BLEND);         
    }
    KillTimer(2);
}
Esempio n. 11
0
STDMETHODIMP CPdnWnd::animate(DWORD flags, DWORD duration)
{
	if(!AnimateWindow(m_hWnd, duration, flags))
	{
		hide(false);
	}
	return S_OK;
}
Esempio n. 12
0
LRESULT CProgressDlg::OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{    
  if(m_ActionOnClose==CLOSE_MYSELF_AND_PARENT)
  {
    AnimateWindow(m_hWnd, 200, AW_HIDE|AW_BLEND); 

	  HWND hWndParent = ::GetParent(m_hWnd);
	  ::PostMessage(hWndParent, WM_CLOSE, 0, 0);
    return 0;
  }
  else if(m_ActionOnClose==CLOSE_MYSELF)
  {
    AnimateWindow(m_hWnd, 200, AW_HIDE|AW_BLEND); 	  
    return 0;
  }
    
  return 0;
}
Esempio n. 13
0
	virtual INT_PTR OnInit() 
	{ 
		// fill informations
		if (m_info.GetInfo()) {
			SetDlgItemText(GetHWND(), IDC_STATIC7, 
				m_info.GetInfo()->GetEngineName());
		} AnimateWindow(this->GetHWND(),500,AW_BLEND);
		return TRUE; 
	}
Esempio n. 14
0
LRESULT CProgressDlg::OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{    
  if(m_bFinished)
  {
    GetParent().PostMessage(WM_CLOSE);
    return 0;
  }

  AnimateWindow(m_hWnd, 200, AW_HIDE|AW_BLEND); 
  return 0;
}
BOOL CSplash::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	CString strFileName;
	strFileName.Format("%s",LoginInformation.path);
	strFileName+="splash.bmp";

	hbmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), \
		strFileName, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION|LR_LOADFROMFILE);

    ////////////////////该断程序用来取得加载的BMP的信息////////////////////////

    m_bitmap.Attach( hbmp );

 //   DIBSECTION ds;

   // BITMAPINFOHEADER &bminfo = ds.dsBmih; 

    m_bitmap.GetObject( sizeof(BITMAP), &bmp );
	

	CRect rtOld,rtProgress;

	GetWindowRect(rtOld);

	CPoint point = rtOld.TopLeft();//pl(bmp.bmWidth-100,bmp.bmHeight-50),pr(bmp.bmWidth-10,bmp.bmHeight-20);

	CRect rtNew = CRect(point,CSize(bmp.bmWidth,bmp.bmHeight));   

	MoveWindow(rtNew);
//调整流动条控件位置	
	rtProgress.left=20;
	rtProgress.top=bmp.bmHeight-52;
	rtProgress.right=bmp.bmWidth-20;
	rtProgress.bottom=rtProgress.top+30;
	m_progress.MoveWindow(rtProgress);


	::SetWindowPos(GetSafeHwnd() , HWND_TOPMOST ,  rtNew.left ,rtNew.top , rtNew.Width() , rtNew.Height(), SWP_NOSIZE );

	
	CenterWindow();
	AnimateWindow(m_hWnd,300,AW_SLIDE|AW_CENTER);
	
	Invalidate(); 

	AfxBeginThread(ConnectData,(LPVOID)this);
	
	AfxBeginThread(schedule,(LPVOID)this);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Esempio n. 16
0
BOOL CPopupDlg::DestroyWindow()
{
	// TODO: Add your specialized code here and/or call the base class
	
	AnimateWindow(200, AW_VER_POSITIVE | AW_HIDE);	
	numOfDlg--;


	//전체 종료일 때는 postmessage 보내면 안됨
	if(!m_bFlagAllDestroy)
		GetParent()->PostMessage(WM_CLOSEPOPDLG, (WPARAM)this, 0);
	
	return CDialogEx::DestroyWindow();
}
Esempio n. 17
0
LRESULT CProgressDlg::OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{   
	// This method is called when user clicks the close (x) button
	// on the dialog.

    if(m_ActionOnClose==CLOSE_MYSELF_AND_PARENT)
    {
        // Hide this window smoothly
        AnimateWindow(m_hWnd, 200, AW_HIDE|AW_BLEND); 

        // Request parent window to close
        HWND hWndParent = ::GetParent(m_hWnd);
        ::PostMessage(hWndParent, WM_CLOSE, 0, 0);
        return 0;
    }
    else if(m_ActionOnClose==CLOSE_MYSELF)
    {
        // Hide this window smoothly
        AnimateWindow(m_hWnd, 200, AW_HIDE|AW_BLEND); 	  
        return 0;
    }

    return 0;
}
Esempio n. 18
0
Window::~Window()
{
  // ... clean up and shut down ... 
  info( "Window destroy" ) ;

  while( !directories.empty() )
  {
    free( directories.top() ) ;
    directories.pop() ;
  }


  // cheesy fade exit
  AnimateWindow( hwnd, 200, AW_HIDE | AW_BLEND );
}
Esempio n. 19
0
LRESULT CResendDlg::OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
    if(m_ActionOnClose==EXIT)
    {
        //AnimateWindow(m_hWnd, 200, AW_HIDE|AW_BLEND);     
        g_CrashInfo.SetLastRemindDateToday();
        CloseDialog(0);
        return 0;
    }
    else if(m_ActionOnClose==HIDE)
    {
        AnimateWindow(m_hWnd, 200, AW_HIDE|AW_BLEND); 	  
        return 0;
    }

    return 0;
}
void
HippoAbstractWindow::hide(void)
{
    if (!showing_)
        return;

#if 0
    g_debug("SIZING: hide %p %s",
        window_, HippoUStr(getClassName()).c_str());
#endif

    if (animate_)
        AnimateWindow(window_, 400, AW_BLEND | AW_HIDE);
    else
        ShowWindow(window_, SW_HIDE);

    showing_ = false;
}
Esempio n. 21
0
static INT_PTR CALLBACK aboutDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg) {
		case WM_INITDIALOG:
			AnimateWindow(hDlg, 500, AW_CENTER);
			return TRUE;
		case WM_COMMAND:
			switch (LOWORD(wParam)) {
				case IDCANCEL:
					EndDialog(hDlg, TRUE);
					break;
				default:
					break;
			}
			return 0;
		default:
			break;
	}
	return FALSE;
}
BOOL CBaseProjectSet::OnInitDialog() 
{
	CDialog::OnInitDialog();
	GetDlgItem(IDC_STATIC_HEAD)->SetFont(&fontTitle);
	GetDlgItem(IDC_STATIC_HEAD)->SetWindowText(strTitle);
	GetDlgItem(IDC_STATIC_CASH_STANDARD)->ShowWindow(SW_SHOW);
	GetDlgItem(IDC_EDIT_CASH_STANDARD)->ShowWindow(SW_SHOW);

	SetWindowText(strTitle);
	

	if( !CDialogMedXL::ReadName(strSql,combo1) ) {
		AfxMessageBox("读取数据出错!!!");
		return false;
	}

	if( flag == 1 ) { //新增



	}
	else if(flag == 2) { //修改
		combo1.SelectString(-1,str[0]);
		edit1.SetWindowText(str[2]);
		edit2.SetWindowText(str[3]);

		editPY.SetWindowText(str[4]);
		editCode.SetWindowText(str[5]);
		editStandardCash.SetWindowText(str[6]);
		

	}
	else return false;

	CenterWindow();
	AnimateWindow(m_hWnd,300,AW_SLIDE|AW_HOR_POSITIVE);
	Invalidate();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Esempio n. 23
0
static DWORD	WINAPI	CreateViewPicWnd(void*bmp)
{
	SetThreadLocale(locale_ID);
	HWND	pic;
	MSG		msg;
	pic=CreateWindowEx(0,_T("ShowPicClass"),_T("截图查看(双击保存)"),
		WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX,
		CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
		0,0,hInst,0);
	SendMessage(pic,STM_SETIMAGE,0,(LPARAM)bmp);
	SetWindowLong(pic,0,GetWindowLong(pic,0)|SHP_DELBMPONCLOSE);
	SendMessage(pic,WM_SETFLAG,0,0);
	SetScaling(pic,5.0);

	AnimateWindow(pic,500,AW_ACTIVATE|AW_VER_NEGATIVE|AW_SLIDE);
	
	while (GetMessage(&msg, NULL, 0, 0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	return msg.wParam;
}
Esempio n. 24
0
//纯文本式的右下角浮出窗口过程
LRESULT CALLBACK NotifyWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	LPNOTIFYWND_DATA pInfo = NULL;
	RECT rc;
	POINT pt;

	//这是一个广播消息
	if(message == g_NotifyInfo.nMsg_ExitNow)
	{
		pInfo = (LPNOTIFYWND_DATA)GetWindowLongPtr(hWnd, GWLP_USERDATA);

		//通知主窗口退出(即客户端主程序退出)
		if(pInfo != NULL && pInfo->mode == MODE_TEXT)
			PostMessage(g_NotifyInfo.hWndMainFrm, WM_EXITNOW, 0, 0);
		return TRUE;
	}

	switch (message)
	{
	case WM_NCCREATE:
		{
			SIZE _size = { 0 };
			LPCREATESTRUCT pCreateStruct = (LPCREATESTRUCT)lParam;

			LPCTSTR pStr = _T("啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊");
			pInfo = (LPNOTIFYWND_DATA)malloc(sizeof(NOTIFYWND_DATA));
			memset(pInfo, 0, sizeof(NOTIFYWND_DATA));
		
			pInfo->mode = (int)(pCreateStruct->lpCreateParams);
			//创建内存位图和DC
			HDC hdc = GetDC(hWnd);
			pInfo->hMemDC = CreateCompatibleDC(hdc);
			HGDIOBJ hOldFont = SelectObject(pInfo->hMemDC, g_NotifyInfo.hFontContent);
			GetTextExtentPoint32(pInfo->hMemDC, pStr, _tcslen(pStr), &_size);
			pInfo->hMemBm = CreateCompatibleBitmap(hdc, _size.cx + g_NotifyInfo.imgSize + 48, 600);
			ReleaseDC(hWnd, hdc);

			SelectObject(pInfo->hMemDC, hOldFont);
			SelectObject(pInfo->hMemDC, pInfo->hMemBm);

			pInfo->contentWidth = _size.cx + g_NotifyInfo.gap;
			pInfo->titleHeight = _size.cy;

			pInfo->rcIcon.left = 3 + g_NotifyInfo.gap;
			pInfo->rcTitle.left = pInfo->rcIcon.left + g_NotifyInfo.iconSize + g_NotifyInfo.gap;
			pInfo->rcTitle.top = 3 + g_NotifyInfo.gap;
			pInfo->rcTitle.bottom = pInfo->rcTitle.top + pInfo->titleHeight;

			pInfo->rcIcon.top = (pInfo->rcTitle.top + pInfo->rcTitle.bottom - g_NotifyInfo.iconSize)/2;
			pInfo->rcIcon.right = pInfo->rcIcon.left + g_NotifyInfo.iconSize;
			pInfo->rcIcon.bottom = pInfo->rcIcon.top + g_NotifyInfo.iconSize;
			
			pInfo->rcContentOutter.left = 3;
			pInfo->rcContentOutter.top = pInfo->rcTitle.bottom + g_NotifyInfo.gap;

			pInfo->rcImg.left = pInfo->rcContentOutter.left + g_NotifyInfo.gap;
			pInfo->rcImg.top = pInfo->rcContentOutter.top + g_NotifyInfo.gap;
			pInfo->rcImg.right = pInfo->rcImg.left + g_NotifyInfo.imgSize;
			pInfo->rcImg.bottom = pInfo->rcImg.top + g_NotifyInfo.imgSize;			

			SetWindowPos(hWnd, HWND_TOPMOST, -10000, -10000, 
				pInfo->wndWidth, pInfo->wndHeight, SWP_HIDEWINDOW);

			pInfo->tme.cbSize = sizeof(TRACKMOUSEEVENT);
			pInfo->tme.dwFlags = TME_LEAVE; //我们需要 WM_MOUSELEAVE 消息;
			pInfo->tme.hwndTrack = hWnd;

			SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)pInfo);
		}
		return TRUE;

	case WM_PAINT:
		{
			pInfo = (LPNOTIFYWND_DATA)GetWindowLongPtr(hWnd, GWLP_USERDATA);
			if(pInfo == NULL) return TRUE;

			PAINTSTRUCT ps;
			HDC hdc = BeginPaint(hWnd, &ps);

			BitBlt(hdc, 0, 0, pInfo->wndWidth, pInfo->wndHeight, pInfo->hMemDC, 0, 0, SRCCOPY);

			//绘制closebtn(有进度条时,不能关闭)
			int imgIndex = IMG_NORMAL;
			if(pInfo->bMouseOnClose)
			{
				imgIndex = (pInfo->bMouseDown && pInfo->bCloseBtnPushed)? IMG_PUSHED : IMG_HOVER;
			}
			g_NotifyInfo.pImgCloseBtns->TransparentBlt(hdc,
				pInfo->rcCloseBtn.left,
				pInfo->rcCloseBtn.top,
				g_NotifyInfo.closeBtnSize,
				g_NotifyInfo.closeBtnSize,
				imgIndex * g_NotifyInfo.closeBtnSize,
				0,
				g_NotifyInfo.closeBtnSize,
				g_NotifyInfo.closeBtnSize,
				RGB(255, 0, 255));
			EndPaint(hWnd, &ps);
		}
		return TRUE;

	case WM_ERASEBKGND:
		return TRUE;

	case WM_UPDATEPROGRESS:
		pInfo = (LPNOTIFYWND_DATA)GetWindowLongPtr(hWnd, GWLP_USERDATA);
		if(pInfo == NULL) return TRUE;
		
		if(pInfo->mode == MODE_PROGRESS)
		{
			LPCTSTR pStr = (LPCTSTR)lParam;
			if(pStr != NULL)
				_tcscpy_s(pInfo->szProgressText, _ARRAYSIZE(pInfo->szProgressText), pStr);
			pInfo->progress = (int)wParam;

			//绘制进度条
			HGDIOBJ hOldFont = SelectObject(pInfo->hMemDC, g_NotifyInfo.hFontContent);
			SetTextColor(pInfo->hMemDC, g_NotifyInfo.clrContent);
				
			FillRect(pInfo->hMemDC, &pInfo->rcProgressText, (HBRUSH)GetStockObject(WHITE_BRUSH));
			DrawText(pInfo->hMemDC, pInfo->szProgressText, -1,
				&pInfo->rcProgressText, DT_LEFT | DT_TOP | DT_SINGLELINE);

			SelectObject(pInfo->hMemDC, hOldFont);

			FillRect(pInfo->hMemDC, &pInfo->rcProgressBar, (HBRUSH)GetStockObject(WHITE_BRUSH));
			CopyRect(&rc, &pInfo->rcProgressBar);
			rc.right = pInfo->rcProgressBar.left + 
				(pInfo->rcProgressBar.right - pInfo->rcProgressBar.left) * pInfo->progress / 100;

			FillRect(pInfo->hMemDC, &rc, GetSysColorBrush(COLOR_ACTIVECAPTION)); //pInfo->hBrush);

			if(pInfo->progress >= 100)
			{
				//5 秒后自动隐藏
				pInfo->bDownloading = FALSE;
				SetTimer(hWnd, TIMERID_NOTIFY_HIDE, 2000, NULL);
			}
			UnionRect(&rc, &pInfo->rcProgressText, &pInfo->rcProgressBar);
			InvalidateRect(hWnd, &rc, FALSE);
		}
		return TRUE;

	case WM_MOUSEMOVE:
		{
			pInfo = (LPNOTIFYWND_DATA)GetWindowLongPtr(hWnd, GWLP_USERDATA);
			if(pInfo == NULL) return TRUE;

			pt.x = GET_X_LPARAM(lParam);
			pt.y = GET_Y_LPARAM(lParam);

			BOOL bTmp = PtInRect(&pInfo->rcCloseBtn, pt);
			if(bTmp != pInfo->bMouseOnClose)
			{
				pInfo->bMouseOnClose = bTmp;
				InvalidateRect(hWnd, &pInfo->rcCloseBtn, FALSE);
			}
			TrackMouseEvent(&pInfo->tme);
		}
		break;

	case WM_MOUSELEAVE:
		pInfo = (LPNOTIFYWND_DATA)GetWindowLongPtr(hWnd, GWLP_USERDATA);
		if(pInfo == NULL) return TRUE;
		if(pInfo->bMouseOnClose)
		{
			pInfo->bMouseOnClose = FALSE;
			InvalidateRect(hWnd, &pInfo->rcCloseBtn, FALSE);
		}
		break;

	case WM_LBUTTONDOWN:
		pInfo = (LPNOTIFYWND_DATA)GetWindowLongPtr(hWnd, GWLP_USERDATA);
		if(pInfo == NULL) return TRUE;

		pt.x = GET_X_LPARAM(lParam);
		pt.y = GET_Y_LPARAM(lParam);
		pInfo->bMouseDown = TRUE;

		if(PtInRect(&pInfo->rcCloseBtn, pt))
		{
			pInfo->bCloseBtnPushed = TRUE;
			InvalidateRect(hWnd, &pInfo->rcCloseBtn, FALSE);
			SetCapture(hWnd);
		}
		break;

	case WM_LBUTTONUP:
		pInfo = (LPNOTIFYWND_DATA)GetWindowLongPtr(hWnd, GWLP_USERDATA);
		if(pInfo == NULL) return TRUE;

		pt.x = GET_X_LPARAM(lParam);
		pt.y = GET_Y_LPARAM(lParam);
		pInfo->bMouseDown = FALSE;

		if(pInfo->bCloseBtnPushed)
		{
			pInfo->bCloseBtnPushed = FALSE;
			ReleaseCapture();
			if(PtInRect(&pInfo->rcCloseBtn, pt))
			{
				KillTimer(hWnd, TIMERID_NOTIFY_SHOWING);
				KillTimer(hWnd, TIMERID_NOTIFY_HIDING);
				KillTimer(hWnd, TIMERID_NOTIFY_TIMEOUT);
				KillTimer(hWnd, TIMERID_NOTIFY_HIDE);
				InvalidateRect(hWnd, &pInfo->rcCloseBtn, FALSE);
				//ShowWindow(hDlg, SW_HIDE);
				//用渐隐( AW_BLEND )的方式隐藏窗口,动画时间:200ms
				AnimateWindow(hWnd, 200, AW_HIDE | AW_BLEND);
			}
		}
		break;

	case WM_TIMER:
		pInfo = (LPNOTIFYWND_DATA)GetWindowLongPtr(hWnd, GWLP_USERDATA);
		if(pInfo == NULL) return TRUE;

		GetWindowRect(hWnd, &rc);
		switch(wParam)
		{
		case TIMERID_NOTIFY_SHOWING:
			if((rc.bottom - rc.top) >= (pInfo->wndHeight - g_NotifyInfo.dy))
			{
				KillTimer(hWnd, wParam);
				SetWindowPos(hWnd, NULL, rc.left, rc.bottom - pInfo->wndHeight,
					pInfo->wndWidth, pInfo->wndHeight, SWP_NOZORDER | SWP_NOACTIVATE);
			}
			else
			{
				SetWindowPos(hWnd, NULL, rc.left, rc.top - g_NotifyInfo.dy,
					pInfo->wndWidth, (rc.bottom - rc.top) + g_NotifyInfo.dy,
					SWP_NOZORDER | SWP_NOACTIVATE);
			}
			break;

		case TIMERID_NOTIFY_HIDING:
			{
				UINT flags = SWP_NOZORDER | SWP_NOACTIVATE;
				if((rc.bottom - rc.top) <= 0)
				{
					KillTimer(hWnd, wParam);
					flags = flags | SWP_HIDEWINDOW;
				}
				SetWindowPos(hWnd, NULL, rc.left, rc.top + g_NotifyInfo.dy,
					pInfo->wndWidth, rc.bottom - rc.top - g_NotifyInfo.dy,
					flags);
			}
			break;

		case TIMERID_NOTIFY_TIMEOUT:
			{
				KillTimer(hWnd, TIMERID_NOTIFY_SHOWING);
				KillTimer(hWnd, TIMERID_NOTIFY_TIMEOUT);
				KillTimer(hWnd, TIMERID_NOTIFY_HIDE);
				SetTimer(hWnd, TIMERID_NOTIFY_HIDING, INTERVAL_NOTIFYWND, NULL);
			}
			break;
		case TIMERID_NOTIFY_HIDE: //立即隐藏
			{
				KillTimer(hWnd, TIMERID_NOTIFY_SHOWING);
				KillTimer(hWnd, TIMERID_NOTIFY_HIDING);
				KillTimer(hWnd, TIMERID_NOTIFY_TIMEOUT);
				KillTimer(hWnd, TIMERID_NOTIFY_HIDE);
				AnimateWindow(hWnd, 200, AW_HIDE | AW_BLEND);
			}
			break;
		}
		break;

	case WM_POWERBROADCAST:
		{
			//TCHAR szText[256];
			//PBT_APMQUERYSUSPEND
			//_stprintf_s(szText, _ARRAYSIZE(szText), _T("NotifyWnd_PowerEvent: event = %x"), wParam);
			//WriteLogLine(szText);
			pInfo = (LPNOTIFYWND_DATA)GetWindowLongPtr(hWnd, GWLP_USERDATA);
			if(pInfo != NULL && pInfo->mode == MODE_TEXT)
				return SendMessage(g_NotifyInfo.hWndMainFrm, WM_POWERBROADCAST, wParam, lParam);
		}
		break;

	case WM_NCDESTROY:
		{
			pInfo = (LPNOTIFYWND_DATA)GetWindowLongPtr(hWnd, GWLP_USERDATA);
			if(pInfo == NULL) return TRUE;
			//DeleteCriticalSection(&g_NotifyInfo.cs);

			DeleteObject(pInfo->hMemBm);
			DeleteDC(pInfo->hMemDC);

			free(pInfo);

			SetWindowLongPtr(hWnd, GWLP_USERDATA, NULL);
		}
		break;

	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}
Esempio n. 25
0
LRESULT CProgressDlg::OnTimer(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
  WORD wTimerId = (WORD)wParam;

  if(wTimerId==0)
  {
    int nProgressPct = 0;
    std::vector<CString> messages;

    GetSenderThreadStatus(nProgressPct, messages);
    
    m_prgProgress.SetPos(nProgressPct);

    int attempt = 0;

    unsigned i;
    for(i=0; i<messages.size(); i++)
    {
      CStatic statText = GetDlgItem(IDC_TEXT);

      if(messages[i].CompareNoCase(_T("[status_success]"))==0)
      { 
        m_bFinished = TRUE;
        statText.SetWindowText(_T("Completed successfuly!"));
        HWND hWndParent = ::GetParent(m_hWnd);
        ::PostMessage(hWndParent, WM_CLOSE, 0, 0);
      }

      if(messages[i].CompareNoCase(_T("[status_failed]"))==0)
      { 
        m_bFinished = TRUE;
        KillTimer(1);
        statText.SetWindowText(Utility::GetINIString(_T("ProgressDlg"), _T("CompletedWithErrors")));
        
        CButton btnCancel = GetDlgItem(IDCANCEL);
        btnCancel.EnableWindow(1);
        btnCancel.SetWindowText(Utility::GetINIString(_T("ProgressDlg"), _T("Close")));
        ShowWindow(SW_SHOW);
      }

      if(messages[i].CompareNoCase(_T("[cancelled_by_user]"))==0)
      { 
        statText.SetWindowText(Utility::GetINIString(_T("ProgressDlg"), _T("Cancelling")));
      }

      if(messages[i].CompareNoCase(_T("[sending_attempt]"))==0)
      {
        attempt ++;      
        CString str;
        str.Format(Utility::GetINIString(_T("ProgressDlg"), _T("StatusText")), attempt);
        statText.SetWindowText(str);
      }
      
      if(messages[i].CompareNoCase(_T("[confirm_launch_email_client]"))==0)
      {       
        KillTimer(1);        
        ShowWindow(SW_SHOW);

        DWORD dwFlags = 0;
        CString sRTL = Utility::GetINIString(_T("Settings"), _T("RTLReading"));
        if(sRTL.CompareNoCase(_T("1"))==0)
          dwFlags = MB_RTLREADING;

        CString sMailClientName;        
        CMailMsg::DetectMailClient(sMailClientName);
        CString msg;
        msg.Format(Utility::GetINIString(_T("ProgressDlg"), _T("ConfirmLaunchEmailClient")), sMailClientName);

        INT_PTR result = MessageBox(msg, 
          Utility::GetINIString(_T("ProgressDlg"), _T("DlgCaption")),
          MB_OKCANCEL|MB_ICONQUESTION|dwFlags);

        FeedbackReady(result==IDOK?0:1);       
        ShowWindow(SW_HIDE);
      }

      int count = m_listView.GetItemCount();
      int indx = m_listView.InsertItem(count, messages[i]);
      m_listView.EnsureVisible(indx, TRUE);

    }
  }

  if(wTimerId==1)
  {
    AnimateWindow(m_hWnd, 200, AW_HIDE|AW_BLEND); 
    KillTimer(1);
  }

  return 0;
}
Esempio n. 26
0
LRESULT CProgressDlg::OnTimer(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
  WORD wTimerId = (WORD)wParam;

  if(wTimerId==0) // Dialog update timer
  {
    // Get current progress
    int nProgressPct = 0;
    std::vector<CString> messages;
    g_ErrorReportSender.GetStatus(nProgressPct, messages);
    
    // Update progress bar
    m_prgProgress.SetPos(nProgressPct);

    int attempt = 0; // Sending attempt

    unsigned i;
    for(i=0; i<messages.size(); i++)
    {  
      if(messages[i].CompareNoCase(_T("[creating_dump]"))==0)
      { 
        m_ActionOnCancel = DONT_CLOSE;
        m_ActionOnClose = CLOSE_MYSELF_AND_PARENT;
        m_statText.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ProgressDlg"), _T("CollectingCrashInfo")));        
      }
      else if(messages[i].CompareNoCase(_T("[copying_files]"))==0)
      { 
        m_ActionOnCancel = DONT_CLOSE;
        m_ActionOnClose = CLOSE_MYSELF_AND_PARENT;
        // Remove marquee style from progress bar
        m_prgProgress.ModifyStyle(PBS_MARQUEE, 0);        
      }
      else if(messages[i].CompareNoCase(_T("[confirm_send_report]"))==0)
      {
        m_ActionOnCancel = CLOSE_MYSELF_AND_PARENT;
        
        if(!g_CrashInfo.m_bSilentMode)
          ShowWindow(SW_HIDE);
        
        HWND hWndParent = ::GetParent(m_hWnd);        
        ::PostMessage(hWndParent, WM_COMPLETECOLLECT, 0, 0);
      }
      else if(messages[i].CompareNoCase(_T("[exporting_report]"))==0)
      {
        m_ActionOnCancel = DONT_CLOSE;
        m_ActionOnClose = DONT_CLOSE;
        CString sCaption;
        sCaption.Format(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ProgressDlg"), _T("DlgCaptionExport")), g_CrashInfo.m_sAppName);
        SetWindowText(sCaption);    
        
        m_statText.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ProgressDlg"), _T("CompressingFiles")));        

        m_btnCancel.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ProgressDlg"), _T("Cancel")));

        ShowWindow(SW_SHOW);
      }
      else if(messages[i].CompareNoCase(_T("[end_exporting_report_ok]"))==0)
      { 
        m_ActionOnCancel = CLOSE_MYSELF;
        ShowWindow(SW_HIDE);
      }
      else if(messages[i].CompareNoCase(_T("[end_exporting_report_failed]"))==0)
      { 
        m_ActionOnCancel = CLOSE_MYSELF;
        m_ActionOnClose = CLOSE_MYSELF;
        m_statText.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ProgressDlg"), _T("ExportedWithErrors")));        
        m_btnCancel.EnableWindow(1);
        m_btnCancel.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ProgressDlg"), _T("Close")));
      }
      else if(messages[i].CompareNoCase(_T("[compressing_files]"))==0)
      {         
        m_ActionOnCancel = DONT_CLOSE; 
        m_ActionOnClose = CLOSE_MYSELF;
        m_statText.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ProgressDlg"), _T("CompressingFiles")));        
        m_btnCancel.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ProgressDlg"), _T("Cancel")));
      }      
      else if(messages[i].CompareNoCase(_T("[end_compressing_files]"))==0)
      { 
        if(!g_CrashInfo.m_bSendErrorReport && g_CrashInfo.m_bStoreZIPArchives)
        {
          m_ActionOnCancel = CLOSE_MYSELF;
          m_ActionOnClose = CLOSE_MYSELF;
          HWND hWndParent = ::GetParent(m_hWnd);        
          ::PostMessage(hWndParent, WM_CLOSE, 0, 0);
        }
      }
      else if(messages[i].CompareNoCase(_T("[status_success]"))==0)
      {         
        m_ActionOnCancel = CLOSE_MYSELF_AND_PARENT;        
        m_ActionOnClose = CLOSE_MYSELF_AND_PARENT;        
        HWND hWndParent = ::GetParent(m_hWnd);        
        ::PostMessage(hWndParent, WM_CLOSE, 0, 0);
      }
      else if(messages[i].CompareNoCase(_T("[status_failed]"))==0)
      {         
        m_ActionOnCancel = CLOSE_MYSELF_AND_PARENT;
        m_ActionOnClose = CLOSE_MYSELF_AND_PARENT;        
        KillTimer(1);
        m_statText.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ProgressDlg"), _T("CompletedWithErrors")));
                
        m_btnCancel.EnableWindow(1);
        m_btnCancel.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ProgressDlg"), _T("Close")));

        if(!g_CrashInfo.m_bSilentMode)
          ShowWindow(SW_SHOW);        
        else
        {
          HWND hWndParent = ::GetParent(m_hWnd);        
          ::PostMessage(hWndParent, WM_CLOSE, 0, 0);        
        }
      }
      else if(messages[i].CompareNoCase(_T("[exit_silently]"))==0)
      {         
        m_ActionOnCancel = CLOSE_MYSELF_AND_PARENT;
        m_ActionOnClose = CLOSE_MYSELF_AND_PARENT;
        KillTimer(1);        
        HWND hWndParent = ::GetParent(m_hWnd);        
        ::PostMessage(hWndParent, WM_CLOSE, 0, 0);
      }
      else if(messages[i].CompareNoCase(_T("[cancelled_by_user]"))==0)
      { 
        m_statText.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ProgressDlg"), _T("Cancelling")));
      }
      else if(messages[i].CompareNoCase(_T("[sending_attempt]"))==0)
      {
        attempt ++;      
        CString str;
        str.Format(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ProgressDlg"), _T("StatusText")), attempt);
        m_statText.SetWindowText(str);
      }
      else if(messages[i].CompareNoCase(_T("[confirm_launch_email_client]"))==0)
      {       
        KillTimer(1);        
        if(!g_CrashInfo.m_bSilentMode)
        {
          ShowWindow(SW_SHOW);

          DWORD dwFlags = 0;
          CString sRTL = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("Settings"), _T("RTLReading"));
          if(sRTL.CompareNoCase(_T("1"))==0)
            dwFlags = MB_RTLREADING;

          CString sMailClientName;        
          CMailMsg::DetectMailClient(sMailClientName);
          CString msg;
          msg.Format(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ProgressDlg"), _T("ConfirmLaunchEmailClient")), sMailClientName);

          CString sCaption = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("ProgressDlg"), _T("DlgCaption"));
          CString sTitle;
          sTitle.Format(sCaption, g_CrashInfo.m_sAppName);
          INT_PTR result = MessageBox(msg, 
            sTitle,
            MB_OKCANCEL|MB_ICONQUESTION|dwFlags);

          g_ErrorReportSender.FeedbackReady(result==IDOK?0:1);       
          ShowWindow(SW_HIDE);
        }
        else
        { 
          // In silent mode, assume user provides his/her consent
          g_ErrorReportSender.FeedbackReady(0);       
        }        
      }

      int count = m_listView.GetItemCount();
      int indx = m_listView.InsertItem(count, messages[i]);
      m_listView.EnsureVisible(indx, TRUE);

    }
  }
  else if(wTimerId==1) // The timer that hides this window
  {
    if(!g_CrashInfo.m_bSilentMode)
      AnimateWindow(m_hWnd, 200, AW_HIDE|AW_BLEND); 
    KillTimer(1);
  }

  return 0;
}
Esempio n. 27
0
void ChangeInfoData::BeginListEdit(int iItem, RECT *rc, int iSetting, WORD wVKey)
{
	if (dataListEdit)
		dataListEdit->EndListEdit(0);

	POINT pt = { 0, 0 };
	ClientToScreen(hwndList, &pt);
	OffsetRect(rc, pt.x, pt.y);
	InflateRect(rc, -2, -2);
	rc->left -= 2;
	iEditItem = iItem;
	ListView_RedrawItems(hwndList, iEditItem, iEditItem);
	UpdateWindow(hwndList);

	dataListEdit = this;
	hwndListEdit = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, _T("LISTBOX"), _T(""), WS_POPUP | WS_BORDER | WS_VSCROLL,
											rc->left, rc->bottom, rc->right - rc->left, 150, NULL, NULL, hInst, NULL);
	SendMessage(hwndListEdit, WM_SETFONT, (WPARAM)hListFont, 0);
	int itemHeight = SendMessage(hwndListEdit, LB_GETITEMHEIGHT, 0, 0);

	const SettingItem &si = setting[iSetting];
	SettingItemData &sid = settingData[iSetting];
	FieldNamesItem *list = (FieldNamesItem*)si.pList;

	// some country codes were changed leaving old details uknown, convert it for the user
	if (list == countryField) {
		if (sid.value == 420)
			sid.value = 42; // conversion of obsolete codes (OMG!)
		else if (sid.value == 421)
			sid.value = 4201;
		else if (sid.value == 102)
			sid.value = 1201;
	}

	if (list == timezonesField) {
		tmi.prepareList(NULL, ppro->m_szModuleName, hwndListEdit, TZF_PLF_LB);
	}
	else {
		int j, n = ListBoxAddStringUtf(hwndListEdit, "Unspecified");
		for (j = 0;; j++)
			if (!list[j].text) {
				SendMessage(hwndListEdit, LB_SETITEMDATA, n, j);
				if ((sid.value == 0 && list[j].code == 0) || (si.dbType != DBVT_ASCIIZ && sid.value == list[j].code))
					SendMessage(hwndListEdit, LB_SETCURSEL, n, 0);
				break;
			}

		for (j = 0; list[j].text; j++) {
			char str[MAX_PATH];
			n = ListBoxAddStringUtf(hwndListEdit, list[j].text);
			SendMessage(hwndListEdit, LB_SETITEMDATA, n, j);
			if ((si.dbType == DBVT_ASCIIZ && (!strcmpnull((char*)sid.value, list[j].text))
				|| (si.dbType == DBVT_ASCIIZ && (!strcmpnull((char*)sid.value, ICQTranslateUtfStatic(list[j].text, str, MAX_PATH))))
				|| ((char*)sid.value == NULL && list[j].code == 0))
				|| (si.dbType != DBVT_ASCIIZ && sid.value == list[j].code))
				SendMessage(hwndListEdit, LB_SETCURSEL, n, 0);
		}
		SendMessage(hwndListEdit, LB_SETTOPINDEX, SendMessage(hwndListEdit, LB_GETCURSEL, 0, 0) - 3, 0);
	}

	int listCount = SendMessage(hwndListEdit, LB_GETCOUNT, 0, 0);
	if (itemHeight * listCount < 150)
		SetWindowPos(hwndListEdit, 0, 0, 0, rc->right - rc->left, itemHeight * listCount + GetSystemMetrics(SM_CYBORDER) * 2, SWP_NOZORDER | SWP_NOMOVE);
	mir_subclassWindow(hwndListEdit, ListEditSubclassProc);
	AnimateWindow(hwndListEdit, 200, AW_SLIDE | AW_ACTIVATE | AW_VER_POSITIVE);
	ShowWindow(hwndListEdit, SW_SHOW);
	SetFocus(hwndListEdit);
	if (wVKey)
		PostMessage(hwndListEdit, WM_KEYDOWN, wVKey, 0);
}
Esempio n. 28
0
LRESULT CProgressDlg::OnTimer(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
  WORD wTimerId = (WORD)wParam;

  if(wTimerId==0)
  {
    int nProgressPct = 0;
    std::vector<CString> messages;

    GetSenderThreadStatus(nProgressPct, messages);
    
    m_prgProgress.SetPos(nProgressPct);

    int attempt = 0;

    unsigned i;
    for(i=0; i<messages.size(); i++)
    {
      CStatic statText = GetDlgItem(IDC_TEXT);

      if(messages[i].CompareNoCase(_T("[status_success]"))==0)
      { 
        m_bFinished = TRUE;
        statText.SetWindowText(_T("Completed successfuly!"));
        GetParent().PostMessage(WM_CLOSE);
      }

      if(messages[i].CompareNoCase(_T("[status_failed]"))==0)
      { 
        m_bFinished = TRUE;
        KillTimer(1);
        statText.SetWindowText(_T("Completed with errors. Press Close to close this window."));
        
        CButton btnCancel = GetDlgItem(IDCANCEL);
        btnCancel.EnableWindow(1);
        btnCancel.SetWindowText(_T("Close"));
        ShowWindow(SW_SHOW);
      }

      if(messages[i].CompareNoCase(_T("[cancelled_by_user]"))==0)
      { 
        statText.SetWindowText(_T("Cancelling..."));
      }

      if(messages[i].CompareNoCase(_T("[sending_attempt]"))==0)
      {
        attempt ++;      
        CString str;
        str.Format(_T("The error report is now being sent (attempt %d of 3)..."), attempt);
        statText.SetWindowText(str);
      }
      
      if(messages[i].CompareNoCase(_T("[confirm_launch_email_client]"))==0)
      {       
        KillTimer(1);
        ShowWindow(SW_SHOW);
        INT_PTR result = MessageBox(_T("Error report can be sent using your default E-mail program.\nPress OK to run the E-mail program or press Cancel to cancel."), 
          _T("Send Error Report"), MB_OKCANCEL|MB_ICONQUESTION);
        FeedbackReady(result==IDOK?0:1);       
        ShowWindow(SW_HIDE);
      }

      int count = m_listBox.GetCount();
      int indx = m_listBox.InsertString(count, messages[i]);
      m_listBox.SetTopIndex(indx);

    }
  }

  if(wTimerId==1)
  {
#if _MSC_VER>=1300
    AnimateWindow(m_hWnd, 200, AW_HIDE|AW_BLEND); 
#else
    ShowWindow(SW_HIDE);
#endif
    KillTimer(1);
  }

  return 0;
}
Esempio n. 29
0
void CSplashWnd::QuitSplashWnd()
{
	//渐隐窗口
	AnimateWindow(300, AW_BLEND | AW_HIDE);
	PostMessage(WM_CLOSE);
}
Esempio n. 30
0
LRESULT CProgressDlg::OnTimer(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	// This method is called when a timer ticks.

    WORD wTimerId = (WORD)wParam;
	CErrorReportSender* pSender = CErrorReportSender::GetInstance();

    if(wTimerId==0) // Dialog update timer
    {
        // Get current progress
        int nProgressPct = 0;
        std::vector<CString> messages;
        pSender->GetCurOpStatus(nProgressPct, messages);

        // Update progress bar
        m_prgProgress.SetPos(nProgressPct);

        int attempt = 0; // Sending attempt

        // Walk through incoming messages and look for special ones (enclosed in [ ])
        unsigned i;
        for(i=0; i<messages.size(); i++)
        {  
            if(messages[i].CompareNoCase(_T("[creating_dump]"))==0)
            { 
                // Creating minidump
                m_ActionOnCancel = DONT_CLOSE;
                m_ActionOnClose = CLOSE_MYSELF_AND_PARENT;
				m_statText.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("CollectingCrashInfo")));        
            }
            else if(messages[i].CompareNoCase(_T("[copying_files]"))==0)
            { 
                // Copying files
                m_ActionOnCancel = DONT_CLOSE;
                m_ActionOnClose = CLOSE_MYSELF_AND_PARENT;
                // Remove marquee style from progress bar
                m_prgProgress.ModifyStyle(PBS_MARQUEE, 0);        
            }
            else if(messages[i].CompareNoCase(_T("[confirm_send_report]"))==0)
            {
                // User should consent to send error report, so we hide this dialog
				// and send a message to our parent dialog that will receive user input.
                m_ActionOnCancel = CLOSE_MYSELF_AND_PARENT;

				ShowWindow(SW_HIDE);

                HWND hWndParent = ::GetParent(m_hWnd);        
                ::PostMessage(hWndParent, WM_COMPLETECOLLECT, 0, 0);
            }
            else if(messages[i].CompareNoCase(_T("[exporting_report]"))==0)
            {
                // Exporting error report as a ZIP archive
                m_ActionOnCancel = DONT_CLOSE;
                m_ActionOnClose = DONT_CLOSE;
                CString sCaption;
				sCaption.Format(pSender->GetLangStr(_T("ProgressDlg"), _T("DlgCaptionExport")), 
					pSender->GetCrashInfo()->m_sAppName);
                SetWindowText(sCaption);    

				m_statText.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("CompressingFiles")));        

				m_btnCancel.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("Cancel")));

                ShowWindow(SW_SHOW);
            }
            else if(messages[i].CompareNoCase(_T("[end_exporting_report_ok]"))==0)
            { 
                // End exporting error report
                m_ActionOnCancel = CLOSE_MYSELF;
                ShowWindow(SW_HIDE);
            }
            else if(messages[i].CompareNoCase(_T("[end_exporting_report_failed]"))==0)
            { 
                // Failed to export error report
                m_ActionOnCancel = CLOSE_MYSELF;
                m_ActionOnClose = CLOSE_MYSELF;
				m_statText.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("ExportedWithErrors")));        
                m_btnCancel.EnableWindow(1);
				m_btnCancel.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("Close")));
            }
            else if(messages[i].CompareNoCase(_T("[compressing_files]"))==0)
            {         
                // Compressing error report files
                m_ActionOnCancel = DONT_CLOSE; 
                m_ActionOnClose = CLOSE_MYSELF;
				m_statText.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("CompressingFiles")));        
				m_btnCancel.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("Cancel")));
            }      
            else if(messages[i].CompareNoCase(_T("[end_compressing_files]"))==0)
            { 
                // File compression finished
				if(!pSender->GetCrashInfo()->m_bSendErrorReport && pSender->GetCrashInfo()->m_bStoreZIPArchives)
                {
                    m_ActionOnCancel = CLOSE_MYSELF;
                    m_ActionOnClose = CLOSE_MYSELF;
                    HWND hWndParent = ::GetParent(m_hWnd);        
                    ::PostMessage(hWndParent, WM_CLOSE, 0, 0);
                }
            }
            else if(messages[i].CompareNoCase(_T("[status_success]"))==0)
            {         
                // Error report has been delivered ok
                m_ActionOnCancel = CLOSE_MYSELF_AND_PARENT;        
                m_ActionOnClose = CLOSE_MYSELF_AND_PARENT;        

				// Close the parent dialog.
                HWND hWndParent = ::GetParent(m_hWnd);        
                ::PostMessage(hWndParent, WM_CLOSE, 0, 0);
            }
            else if(messages[i].CompareNoCase(_T("[status_failed]"))==0)
            {         
                // Error report delivery has failed
                m_ActionOnCancel = CLOSE_MYSELF_AND_PARENT;
                m_ActionOnClose = CLOSE_MYSELF_AND_PARENT;        
                
				// Stop timer
				KillTimer(1);

				// Update status text.
				m_statText.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("CompletedWithErrors")));

				// Enable "Close" button
                m_btnCancel.EnableWindow(1);
				m_btnCancel.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("Close")));

				// Show the dialog
				ShowWindow(SW_SHOW);        
            }
            else if(messages[i].CompareNoCase(_T("[exit_silently]"))==0)
            {         
                // Silent exit
                m_ActionOnCancel = CLOSE_MYSELF_AND_PARENT;
                m_ActionOnClose = CLOSE_MYSELF_AND_PARENT;

				// Stop timer
                KillTimer(1);        

				// Close the parent dialog.
                HWND hWndParent = ::GetParent(m_hWnd);        
                ::PostMessage(hWndParent, WM_CLOSE, 0, 0);
            }
            else if(messages[i].CompareNoCase(_T("[cancelled_by_user]"))==0)
            { 
                // The operation was cancelled by user
				m_statText.SetWindowText(pSender->GetLangStr(_T("ProgressDlg"), _T("Cancelling")));
            }
            else if(messages[i].CompareNoCase(_T("[sending_attempt]"))==0)
            {
                // Trying to send error report using another method
                attempt ++;      
                CString str;
				str.Format(pSender->GetLangStr(_T("ProgressDlg"), _T("StatusText")), attempt);
                m_statText.SetWindowText(str);
            }
            else if(messages[i].CompareNoCase(_T("[confirm_launch_email_client]"))==0)
            {       
                // User should confirm he allows to launch email client
                KillTimer(1);        
                
				// Show the dialog
				ShowWindow(SW_SHOW);

				// Determine window mirroring settings.
                DWORD dwFlags = 0;
				CString sRTL = pSender->GetLangStr(_T("Settings"), _T("RTLReading"));
                if(sRTL.CompareNoCase(_T("1"))==0)
                    dwFlags = MB_RTLREADING;

				// Display the message box, so user to be able to confirm.
                CString sMailClientName;        
                CMailMsg::DetectMailClient(sMailClientName);
                CString msg;
				msg.Format(pSender->GetLangStr(_T("ProgressDlg"), _T("ConfirmLaunchEmailClient")), sMailClientName);

				CString sCaption = pSender->GetLangStr(_T("ProgressDlg"), _T("DlgCaption"));
                CString sTitle;
				sTitle.Format(sCaption, pSender->GetCrashInfo()->m_sAppName);
                INT_PTR result = MessageBox(msg, 
                    sTitle,
                    MB_OKCANCEL|MB_ICONQUESTION|dwFlags);

				// Unblock worker thread.
                pSender->FeedbackReady(result==IDOK?0:1);       

				// Hide the dialog
                ShowWindow(SW_HIDE);                
            }

            // Ensure the last item of the log is visible
            int count = m_listView.GetItemCount();
            int indx = m_listView.InsertItem(count, messages[i]);
            m_listView.EnsureVisible(indx, TRUE);

        }
    }
    else if(wTimerId==1) // The timer that hides this window
    {
		// Hide the window smoothly
		AnimateWindow(m_hWnd, 200, AW_HIDE|AW_BLEND); 
		// Stop the timer
        KillTimer(1);
    }

    return 0;
}