void CListCtrlEx::InsertProgresCtrl(int iIndex, int iStatus)
{
	CHeaderCtrl* pHeader = GetHeaderCtrl();
	
	CRect ColRt;
	pHeader->GetItemRect(m_iProgressColumn, &ColRt);
	 //get the rect
	CRect rt;
	GetItemRect(iIndex, &rt, LVIR_LABEL);
	rt.top += 1;
	rt.bottom -= 1;
	rt.left += ColRt.left;
	int Width = ColRt.Width();
	rt.right = rt.left + Width - 4;
	
	rt.left = ColRt.left+1;
	rt.right = ColRt.right-1;

	CProgressCtrl *pControl = new CProgressCtrl;
	pControl->Create(WS_CHILD|WS_VISIBLE, rt, this, IDC_PROGRESS_LIST + iIndex);
	pControl->SetRange(0, 100);
	pControl->SetPos(iStatus);
	pControl->ShowWindow(SW_SHOWNOACTIVATE);
	
	 //add them to the list
	m_ProgressList.push_back(pControl);
}
Example #2
0
BOOL CoptimizerDlg::OnInitDialog()
{
	CSliderCtrl *Slider = (CSliderCtrl *)GetDlgItem(IDC_SLIDER_CUSTOM);
	CComboBox *CBox = (CComboBox *)GetDlgItem(IDC_COMBO_PRESET);
	CProgressCtrl *ProgressBar = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS);
	CString buf;
	CDialog::OnInitDialog();

	SetIcon(m_hIcon, TRUE);
	SetIcon(m_hIcon, FALSE);
	
	CheckRadioButton(IDC_RADIO_PRESET, IDC_RADIO_CUSTOM, IDC_RADIO_PRESET);

	Slider->SetRange(1000, 10000);
	Slider->SetTicFreq(1000);	

	CBox->ResetContent();
	for(int i = 0; i < NUMSTRINGS; i++) {
		buf.LoadString(IDS_STRING1 + i);
		CBox->AddString(buf);
	}

	CBox->SetCurSel(2);
	SetSlider(Slider, 2);

	ProgressBar->SetRange(0, 100);

	return TRUE;
}
Example #3
0
BOOL CTransferDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  Add extra initialization here
	TRACE("CTransferDlg::OnInitDialog() \n");

	CProgressCtrl* pProgress = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS_FILE);
	pProgress->SetRange(0, 100);

	CProgressCtrl* pTotalProgress = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS_TOTAL);
	pTotalProgress->SetRange(0, 100);

	m_UpdateMgr.Create();
	m_UpdateMgr.BindUIObserver(new MUIObserverTransDlg(this));

	PostMessage(WM_TRANSFER_INIT);
	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CInstallerUninstallPage::OnInitDialog ()
{
	if (!CInstallerPage::OnInitDialog ()) {
		return FALSE;
	}

	SetCtrlItemFont (IDC_UNINSTALL_PAGE_LABEL1);

	GetDlgItem (IDC_UNINSTALL_PAGE_LABEL1)->SetWindowText (g_AppConfig.GetStatusLabel ());

	CProgressCtrl *pProgressCtrl = (CProgressCtrl*)GetDlgItem (IDC_UNINSTALL_PAGE_PROGRESS1);
	pProgressCtrl->SetRange (0, 100);

	return TRUE;
}
BOOL CIwProgressPropertyPage::OnInitDialog()
{
	CProgressCtrl* ctlProgress = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS);
	ctlProgress->SetRange(0, 100);
	ctlProgress->SetPos(1);

	CPropertySheet* parent = (CPropertySheet*)GetParent();
	parent->PostMessage(PSM_PRESSBUTTON, PSBTN_NEXT, 0);
	CWnd* pwndNextBut = parent->GetDlgItem(ID_WIZNEXT);
	CWnd* pwndCancelBut = parent->GetDlgItem(IDCANCEL);
	if (pwndNextBut)
		pwndNextBut->EnableWindow(0);
	if (pwndCancelBut)
		pwndCancelBut->EnableWindow(0);

	return TRUE;  
}
Example #6
0
void CWaterCheckDlg::Watermark_Thread()
{
	CProgressCtrl *pProgCtrl = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS_CHECK);
	pProgCtrl->SetRange(0, 1000);
	pProgCtrl->SetPos(0);

	PLAY_SetStreamOpenMode( WATERMARK_PORT, STREAME_FILE);
	PLAY_OpenStream(WATERMARK_PORT, NULL, 0, 1024 * 100);
	
	PLAY_SetDecCallBack(WATERMARK_PORT, MediaDecCBFun);
	PLAY_SetDecCBStream(WATERMARK_PORT, 3);
	
	if (!PLAY_Play(WATERMARK_PORT, NULL))
	{
		PLAY_CloseStream(WATERMARK_PORT);
	}
		
	PLAY_SetWaterMarkCallBackEx(WATERMARK_PORT, CBWaterMarkFuncEx, (long)this);
	
	CFile SourceFile;
	if ( !SourceFile.Open(m_csFilePath, CFile::modeRead | CFile::shareDenyNone) )
	{
		PLAY_Stop(WATERMARK_PORT);
		PLAY_CloseStream(WATERMARK_PORT);
	}

	DWORD dwFileLen = SourceFile.GetLength();	
	
	const int BUFLEN = 8 * 1024;
	BYTE InfoBuf[BUFLEN];
	DWORD nRead;
	DWORD dwCurPos = 0;
	
	try
	{
		while (m_bCheckEnable)
		{
			memset(InfoBuf, 0, sizeof(InfoBuf));
			nRead = SourceFile.Read(InfoBuf, BUFLEN);
			
			if (nRead <= 0)
			{
				break;
			}

			dwCurPos += nRead;			
			
			while (m_bCheckEnable && !PLAY_InputData( WATERMARK_PORT, InfoBuf, nRead))//阻塞为false
			{
				Sleep(5);
			}

			double fpress = (double)dwCurPos/(double)dwFileLen;

			int iProgressPos = (int)(fpress*1000.0);
			if (m_bCheckEnable)
				pProgCtrl->SetPos(iProgressPos);
		}
	}
	catch (CException* e)
	{
		PLAY_Stop(WATERMARK_PORT);
		PLAY_CloseStream(WATERMARK_PORT);
		SourceFile.Close();
		e->Delete();
	}
	
	while (m_bCheckEnable && !(PLAY_GetSourceBufferRemain(WATERMARK_PORT) == 0))
	{
		//解码结束, number=0时,解码出来的数据都已显示或回调完全
		//number < num时,解码基本完成
		while (m_bCheckEnable && PLAY_GetSourceBufferRemain(WATERMARK_PORT) > 0)
		{
			if (PLAY_GetBufferValue(WATERMARK_PORT, BUF_VIDEO_RENDER) < 1) 
			{
				//解码结束的相关操作
				Sleep(5);
				break;
			}
			else
			{
				Sleep(10);
			}
		}
	}
	
	pProgCtrl->SetPos(1000);
	
	PLAY_Stop(WATERMARK_PORT);
	PLAY_CloseStream(WATERMARK_PORT);
	SourceFile.Close();

	if (m_bCheckEnable)
	{
		MessageBox("Watermark Check Complete!!");
		
		m_bCheckEnable = FALSE;		
		GetDlgItem(IDC_BUTTON_CHECK)->SetWindowText("check");
	}
	pProgCtrl->SetPos(0);
}
Example #7
0
void CModel::Resequence(bool bReScanASEFiles /* = false */)
{
	CWaitCursor wait;
	CRect Rect;

	CProgressCtrl *pProgress = NULL;

	if (bReScanASEFiles && ((CAssimilateApp*)AfxGetApp())->m_pMainWnd)
	{
		pProgress = new CProgressCtrl;
		bool bOK = !!pProgress->Create(	WS_CHILD|WS_VISIBLE|PBS_SMOOTH,		// DWORD dwStyle, 
									CRect(100,100,200,200),				// const RECT& rect, 
									((CAssimilateApp*)AfxGetApp())->m_pMainWnd,	// CWnd* pParentWnd, 
									1									// UINT nID 
									);
		if (!bOK)
		{
			delete pProgress;
			pProgress = NULL;
		}
	}
	
	int iTotMasterSequences = GetTotMasterSequences();
	if (pProgress)
	{			
		pProgress->SetRange(0,iTotMasterSequences);
	}
	int iSequenceNumber=0;

	int curFrame = 0;
	CSequence* curSequence = m_sequences;
	while(curSequence != NULL)
	{
		if (pProgress)
		{
			pProgress->SetPos(iSequenceNumber++);
			wait.Restore();
		}
		
		// mark current enums as valid or not...

		curSequence->SetValidEnum(((CAssimilateApp*)AfxGetApp())->ValidEnum(curSequence->GetEnum()));
	
		for (int _i=0; _i<MAX_ADDITIONAL_SEQUENCES; _i++)
		{
			CSequence *additionalSeq = curSequence->AdditionalSeqs[_i];

			additionalSeq->SetValidEnum(((CAssimilateApp*)AfxGetApp())->ValidEnum(additionalSeq->GetEnum()));
		}

		if ( bReScanASEFiles )
		{
			// new code, first of all check for changed framecounts (ie updated ASE file), and update sequence if nec...

			CString nameASE = ((CAssimilateApp*)AfxGetApp())->GetQuakeDir();
					nameASE+= curSequence->GetPath();

			if (!FileExists(nameASE))
			{
				if (gbCarWash_DoingScan)
				{
					strCarWashErrors += va("Model file missing: \"%s\"\n",nameASE);
				}
				else
				{
					if ( gbReportMissingASEs )
					{	
						gbReportMissingASEs = GetYesNo(va("Model file missing: \"%s\"\n\nContinue recieving this message?",nameASE));
					}
				}
			}
			else
			{
				int iStartFrame, iFrameCount, iFrameSpeed;

				iFrameCount = curSequence->GetFrameCount();	// default it in case we skip an XSI read
				iFrameSpeed = curSequence->GetFrameSpeed();	// default it in case we cache this file

				curSequence->ReadASEHeader( nameASE, iStartFrame, iFrameCount, iFrameSpeed, true);	// true = can skip XSI read

				if ( iFrameCount != curSequence->GetFrameCount() )
				{
					if (gbCarWash_DoingScan)
					{
						strCarWashErrors += va("file: \"%s\" has a framecount of %d, but .CAR file says %d\n",nameASE,iFrameCount,curSequence->GetFrameCount());
					}
					else
					{
						// don't mention it if the current count is zero, it's probably a new anim we've just added...

						if ( curSequence->GetFrameCount() )
						{
							if (giFixUpdatedASEFrameCounts == YES || giFixUpdatedASEFrameCounts == NO)
							{
								CYesNoYesAllNoAll query(	va("Model file: \"%s\"",nameASE),
															"",
															va("... has a framecount of %d instead of %d as the QDT/CAR file says",iFrameCount, curSequence->GetFrameCount()),
															"",
															"",
															"Do you want me to fix this?"
															);
								giFixUpdatedASEFrameCounts = query.DoModal();
							}
						}

						// update the sequence?...

						if (giFixUpdatedASEFrameCounts == YES || giFixUpdatedASEFrameCounts == YES_ALL 
							|| !curSequence->GetFrameCount()	// update: I think this should be here?
							)
						{
							curSequence->SetFrameCount( iFrameCount );
						}
					}
				}
			}

			// findmeste:	this no longer seems to do anything under JK2, presumablt EF1-only?
#if 0
			// now try to do any auto-associate between the ASE filename base and the existing enums, 
			//	so if we find (eg) /...../...../CROUCH.ASE and we have BOTH_CROUCH then auto-set the enum to BOTH_CROUCH

			CString stringASEName = nameASE;
			Filename_BaseOnly(stringASEName);	// now = (eg) "falldeath" or "injured" etc 			

			for (int i=0; ; i++)
			{
				LPCSTR p = ((CAssimilateApp*)AfxGetApp())->GetEnumEntry(i);	

				if (!p)		// EOS?
					break;

				CString stringEnum = p;

				// note, I could check stuff like "IsEnumSeperator(LPCSTR lpString)" on <p>, but you'd never
				//	have one of those enums assigned to a sequence anyway.

				char *psEnumPosAfterUnderScore = strchr(stringEnum,'_');
				if (psEnumPosAfterUnderScore++)	// check it, and skip to next char 
				{
					// does this enum match the ASE name?

					if ( !stricmp( psEnumPosAfterUnderScore, stringASEName ) )
					{
						// ok, we've found a good candidate, so set it...  (no need for query-prev code, but I wanted to)

						if ( strcmp( curSequence->GetEnum(), stringEnum))
						{
							curSequence->SetEnum(stringEnum);
						}
					}
				}
				else
				{						
					// this should never happen...

					if (gbCarWash_DoingScan)
					{
						strCarWashErrors += va("found an anim enum with no underscore: \"%s\"\n",stringEnum);
					}
					else
					{
						ASSERT(0);
						ErrorBox(va("Error! Somehow I found an anim enum with no underscore: \"%s\"",stringEnum));
					}
				}
			}
#endif
		}

		// More bollox for Gummelt... :-)
		// now do the other freaky trick (you'd better be grateful for all this Mike!!! <g>), which is:

		// If you find the substring DEATH in this (master) sequence's enum, then ensure that the first *additional*
		//	sequence of it is set to be the corresponding DEAD enum, but using the last frame only (and non-looping)
		//
		// (... or something...)

		{	// keep scope local for neatness

			if ( strstr (curSequence->GetEnum(), "DEATH") )
			{
				// scan this sequence's additional sequences for a DEAD of the same basic type...

				CString stringEnumDEAD = curSequence->GetEnum();

				ASSERT(!IsEnumSeperator(stringEnumDEAD));

				stringEnumDEAD.Replace("DEATH","DEAD");

				// 1st, is there even a corresponding DEAD enum in the global enum table that we can look for...

				CString stringEnum;
				bool bEnumFound = false;
				for (int iEnumEntry=0; !bEnumFound; iEnumEntry++)
				{
					LPCSTR p = ((CAssimilateApp*)AfxGetApp())->GetEnumEntry(iEnumEntry);	

					if (!p)		// EOS?
						break;

					stringEnum = p;

					// note, I could check stuff like "IsEnumSeperator(LPCSTR lpString)" on <p>, but you'd never
					//	have one of those enums assigned to a sequence anyway.

					// does this enum match the one we've built?

					if ( !_stricmp( stringEnum, stringEnumDEAD ) )
					{
						bEnumFound = true;
					}
				}

				if ( bEnumFound )
				{
					// ok, there *is* one of these, so let's scan this sequence's additional sequences to see if we've
					//	got it...

					CSequence *additionalSeq;	// outside FOR scope
					for (int i=0; i<MAX_ADDITIONAL_SEQUENCES; i++)
					{
						additionalSeq = curSequence->AdditionalSeqs[i];

						if (additionalSeq->AdditionalSequenceIsValid())
						{
							if (!strcmp(additionalSeq->GetEnum(),stringEnum))
							{
								break;	// we've found one!
							}
						}
					}

					// if we didn't find one, NULL the ptr
					if (int i=MAX_ADDITIONAL_SEQUENCES)
					{
						additionalSeq = NULL;
					}

					// did we find one? (or did it have the wrong info in?)

					if ( additionalSeq == NULL // didn't find one
						|| additionalSeq->GetFrameCount()!=1
						|| additionalSeq->GetLoopFrame() !=-1
						|| additionalSeq->GetStartFrame()!= curSequence->GetFrameCount()-1
						|| additionalSeq->GetFrameSpeed()!= curSequence->GetFrameSpeed()
						)
					{
						// find a slot to add this new sequence to, or use the faulty one...

						if (additionalSeq == NULL)
						{
							for (int i=0; i<MAX_ADDITIONAL_SEQUENCES; i++)
							{
								additionalSeq = curSequence->AdditionalSeqs[i];

								if (!additionalSeq->AdditionalSequenceIsValid())
								{
									break;	// found an unused slot
								}
							}
						}

						// so have we got a slot to work with?

						if ( additionalSeq == NULL )
						{
							if (gbCarWash_DoingScan)
							{
								strCarWashErrors += va( "F**k!!!: I need an 'additional sequence' slot free in the entry: \"%s\" to generate a DEAD seq, but there isn't one spare. Edit this yourself later.\n",curSequence->GetPath());
							}
							else
							{
								ErrorBox( va( "F**k!!!\n\nI need an 'additional sequence' slot free in the ASE:\n\n\"%s\"\n\n... to generate a DEAD seq, but there isn't one spare. Edit this yourself later.",curSequence->GetPath()));
							}
						}
						else
						{
							additionalSeq->SetStartFrame( curSequence->GetFrameCount()-1 );
							additionalSeq->SetFrameCount( 1 );
							additionalSeq->SetLoopFrame (-1 );
							additionalSeq->SetFrameSpeed( curSequence->GetFrameSpeed() );
							additionalSeq->SetEnum ( stringEnumDEAD );
						}
					}
				}
			}
		}

		curSequence->SetTargetFrame(curFrame + curSequence->GetStartFrame());	// slightly more legal than just (curFrame)

		// update: now set any additional sequences within it...

		for (int i=0; i<MAX_ADDITIONAL_SEQUENCES; i++)
		{
			curSequence->AdditionalSeqs[i]->SetTargetFrame(curFrame + curSequence->AdditionalSeqs[i]->GetStartFrame());
		}

		curFrame += curSequence->GetFrameCount();
		curFrame += curSequence->GetGenLoopFrame()?1:0;	// findme:  is this right?  I hate this system
		curSequence = curSequence->GetNext();
	}
	m_totFrames = curFrame;

	ghAssimilateView->GetDocument()->SetModifiedFlag();

	if (pProgress)
	{
		delete pProgress;
		pProgress = 0;
	}
}
Example #8
0
void CDBFExplorerDoc::ExportToHTML(LPCTSTR lpszFileName)
{
   USES_CONVERSION;
	try
	{
		CFile file;
		CString strHTML;

		// Create "progress bar"
		CProgressCtrl wndProgress;

		GetActiveFrame()->ShowProgressBar(&wndProgress, _T("Exporting records, press Esc to cancel..."));
    
		// Initialize progress control range and step size
		wndProgress.SetRange(0, 100);

		int nCount = m_dBaseFile->GetRecordCount();

		if (file.Open(lpszFileName, CFile::modeWrite | CFile::shareExclusive | CFile::modeCreate, NULL))
		{
			strHTML = "<HTML>\r\n";
			file.Write(strHTML, strHTML.GetLength());
			strHTML = "<HEAD>\r\n";
			file.Write(strHTML, strHTML.GetLength());
			strHTML = "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html;charset=windows-1252\">\r\n";
			file.Write(strHTML, strHTML.GetLength());
			strHTML.Format(_T("<TITLE>%s</TITLE>\r\n"), GetTitle());
			file.Write(strHTML, strHTML.GetLength());
			strHTML = "</HEAD>\r\n";
			file.Write(strHTML, strHTML.GetLength());
			strHTML = "<BODY>\r\n";
			file.Write(strHTML, strHTML.GetLength());
			strHTML.Format(_T("<TABLE BORDER=1 BGCOLOR=#FFFFFF CELLSPACING=0><FONT FACE=\"Arial\" COLOR=#000000><CAPTION><B>%s</B></CAPTION></FONT>\r\n"), GetTitle().operator LPCTSTR());
			file.Write(strHTML, strHTML.GetLength());

			strHTML = "<THEAD>\r\n<TR>\r\n";
			file.Write(strHTML, strHTML.GetLength());

			// show fieldnames
			for (size_t i = 0; i < m_dBaseFile->GetFieldCount(); i++)
			{
            DBF_FIELD_INFO info;
            if (m_dBaseFile->GetFieldInfo(i, &info))
		      {
					strHTML.Format(_T("<TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT SIZE=2 FACE=\"Arial\" COLOR=#000000>%s</FONT></TH>\r\n"), 
                  A2CT(info.name));
					file.Write(strHTML, strHTML.GetLength());
				}
			}
			strHTML = "</TR>\r\n</THEAD>\r\n\r\n<TBODY>\r\n";
			file.Write(strHTML, strHTML.GetLength());

			// show all records
			for(int rc=m_dBaseFile->GetFirstRecord(); rc==DBASE_SUCCESS; rc=m_dBaseFile->GetNextRecord())
  			{
				// Test for "Esc" key
				if( ::GetAsyncKeyState(VK_ESCAPE) < 0)
				{
					break;
				}

				int nItem = m_dBaseFile->GetPosition();
				
				// do not show deleted records
				if (m_dBaseFile->IsRecordDeleted() && !GetActiveFrame()->m_bShowDeletedRecords)
					continue;

				strHTML = "<TR VALIGN=TOP>\r\n";
				file.Write(strHTML, strHTML.GetLength());
				
				for (size_t i = 0; i < m_dBaseFile->GetFieldCount(); i++)
				{
					CString szBuff;

               DBF_FIELD_INFO info;
               m_dBaseFile->GetFieldInfo(i, &info);
					if (info.type == DBF_DATA_TYPE_MEMO)
					{
						szBuff = _T("MEMO");
					}
					else
					{
						m_dBaseFile->Read(i, &szBuff);
					}
					strHTML.Format(_T("<TD BORDERCOLOR=#c0c0c0 ><FONT SIZE=2 FACE=\"Arial\" COLOR=#000000>%s</FONT></TD>\r\n"), 
                  szBuff.operator LPCTSTR());
					file.Write(strHTML, strHTML.GetLength());
				}

				strHTML = "</TR>\r\n";
				file.Write(strHTML, strHTML.GetLength());

				// Update progress control
				int nPos = (nItem*100)/nCount;
				wndProgress.SetPos(nPos);
			}	
			strHTML = "</TBODY>\r\n<TFOOT></TFOOT>\r\n</TABLE>\r\n";
			file.Write(strHTML, strHTML.GetLength());
			strHTML = "</BODY>\r\n";
			file.Write(strHTML, strHTML.GetLength());
			strHTML = "</HTML>\r\n";
			file.Write(strHTML, strHTML.GetLength());
		}
	}
	catch(CFileException *e)
	{
		e->Delete();
		MessageBox(GetFocus(), _T("Failed to export database!"), _T("Export Database"), MB_OK | MB_ICONSTOP);
	}
	// Ensures that idle message is displayed again
	GetActiveFrame()->PostMessage(WM_SETMESSAGESTRING, (WPARAM) AFX_IDS_IDLEMESSAGE, 0L);
}
Example #9
0
void CDBFExplorerDoc::ExportToText(LPCTSTR lpszFileName)
{
   USES_CONVERSION;
	try
	{
		CFile file;

		// Create "progress bar"
		CProgressCtrl wndProgress;

		GetActiveFrame()->ShowProgressBar(&wndProgress, _T("Exporting records, press Esc to cancel..."));
    
		// Initialize progress control range and step size
		wndProgress.SetRange(0, 100);

		int nCount = m_dBaseFile->GetRecordCount();

		if (file.Open(lpszFileName, CFile::modeWrite | CFile::shareExclusive | CFile::modeCreate, NULL))
		{
	    	// show all records
			for(int rc=m_dBaseFile->GetFirstRecord(); rc==DBASE_SUCCESS; rc=m_dBaseFile->GetNextRecord())
  			{
				// Test for "Esc" key
				if( ::GetAsyncKeyState(VK_ESCAPE) < 0)
				{
					break;
				}

				int nItem = m_dBaseFile->GetPosition();
				
				// do not show deleted records
				if (m_dBaseFile->IsRecordDeleted() && !GetActiveFrame()->m_bShowDeletedRecords)
					continue;

				for (size_t i = 0; i < m_dBaseFile->GetFieldCount(); i++)
				{
					CString szBuff;

               DBF_FIELD_INFO info;
               m_dBaseFile->GetFieldInfo(i, &info);
					if (info.type == DBF_DATA_TYPE_MEMO)
					{
						szBuff = _T("MEMO");
					}
					else
					{
						m_dBaseFile->Read(i, &szBuff);
					}
					if (i != 1)
						file.Write(",", 1);
					file.Write(T2CA(szBuff), szBuff.GetLength());
				}
				file.Write("\r\n", 2);
				// Update progress control
				int nPos = (nItem*100)/nCount;
				wndProgress.SetPos(nPos);
			}	
		}
	}
	catch(CFileException *e)
	{
		e->Delete();
		MessageBox(GetFocus(), _T("Failed to export database!"), _T("Export Database"), MB_OK | MB_ICONSTOP);
	}
	// Ensures that idle message is displayed again
	GetActiveFrame()->PostMessage(WM_SETMESSAGESTRING, (WPARAM) AFX_IDS_IDLEMESSAGE, 0L);
}	
Example #10
0
BOOL CBackEndDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	//setup the icon for this window
	SetIcon(m_hMainIcon, TRUE);			// Set big icon
	SetIcon(m_hMainIcon, FALSE);		// Set small icon

	//make it so that the OK button is hidden, it will be revealed again once the processing
	//is done
	((CButton*)GetDlgItem(IDOK))->ModifyStyle(WS_VISIBLE, 0);

	//set up the save button to be invisible and have the disk icon
	((CButton*)(GetDlgItem(IDC_BUTTON_SAVE_LOG)))->SetIcon(m_hSaveIcon);
	((CButton*)GetDlgItem(IDC_BUTTON_SAVE_LOG))->ModifyStyle(WS_VISIBLE, 0);

	((CButton*)(GetDlgItem(IDC_BUTTON_MESSAGE_OPTIONS)))->SetIcon(m_hOptionsIcon);

	//setup the progress bar
	CProgressCtrl* pProgress = ((CProgressCtrl*)GetDlgItem(IDC_PROGRESS_TASK));
	pProgress->SetRange(0, 1000);

	//the base registry location
	CString sRegBase = PACKER_REGISTRY_DIRECTORY;

	//set the thread priority to normal
	uint32 nThreadPri = atoi(GetRegistryKey(HKEY_CURRENT_USER, sRegBase + "ThreadPri", "2"));
	((CComboBox*)GetDlgItem(IDC_COMBO_THREAD_PRIORITY))->SetCurSel(nThreadPri);

	//set the message filter to show everything
	uint32 nFilter = atoi(GetRegistryKey(HKEY_CURRENT_USER, sRegBase + "Filter", "5"));
	((CComboBox*)GetDlgItem(IDC_COMBO_MESSAGE_FILTER))->SetCurSel(nFilter);
	OnChangeMessageFilter();

	//create the thread data
	g_ThreadData.m_sFilename		= m_sFilename;
	g_ThreadData.m_pIPackerImpl		= m_pIPackerImpl;
	g_ThreadData.m_pIPackerOutput	= (IPackerOutput*)this;
	g_ThreadData.m_pPropList		= m_pPropList;

	//load the options for the severities
	LoadSevOptionsFromReg();

	//setup the tooltips
	m_ToolTip.Create(this);
	m_ToolTip.AddWindowTool(GetDlgItem(IDC_BUTTON_SAVE_LOG), IDS_TOOLTIP_SAVE_LOG);
	m_ToolTip.AddWindowTool(GetDlgItem(IDC_COMBO_THREAD_PRIORITY), IDS_TOOLTIP_THREAD_PRIORITY);
	m_ToolTip.AddWindowTool(GetDlgItem(IDC_COMBO_MESSAGE_FILTER), IDS_TOOLTIP_MESSAGE_FILTER);
	m_ToolTip.AddWindowTool(GetDlgItem(IDC_PROGRESS_TASK), IDS_TOOLTIP_TASK_PROGRESS);
	m_ToolTip.AddWindowTool(GetTaskList(), IDS_TOOLTIP_TASK_LIST);
	m_ToolTip.AddWindowTool(GetMessageList(), IDS_TOOLTIP_MESSAGE_LIST);
	m_ToolTip.AddWindowTool(GetDlgItem(IDC_BUTTON_MESSAGE_OPTIONS), IDS_TOOLTIP_MESSAGE_OPTIONS);

	//now we need to launch the background thread which will spawn the packer to do its
	//thing
	DWORD nThreadID;
	m_hThread = CreateThread(NULL, 0, LaunchPackerThreadMain, NULL, 0, &nThreadID); 
	
	//now that the thread is created, we need to ensure that the proper priority is set
	//on it
	OnThreadPriorityChanged();
	
	SetTimer(TIMER_EVENT_ID, 50, NULL);	
	
	return TRUE;  
}