Example #1
0
//	neue Tabelle ausgewählt
void CInputTablePage::OnSelchangeTables() 
{
	int iSel = m_lbTables.GetCurSel ();			
	if (iSel < 0)
		return;

	try
	{
		CMutex mt;
		CWaitCursor wc;
		ASSERT (NULL != m_pParams);
		ASSERT (m_pParams -> m_SourceDatabase.IsOpen ());

	//	Set öffnen
		if (m_pParams -> m_SourceSet.IsOpen ())
			m_pParams -> m_SourceSet.Close ();
		CString strTable, strSQL;
		m_lbTables.GetText (iSel, strTable);
		m_pParams -> m_SourceSet.m_pDatabase = &m_pParams -> m_SourceDatabase;
		AfxFormatString1 (strSQL, IDS_SELECT_ALL, strTable);
		m_pParams -> m_SourceSet.Open (dbOpenSnapshot, strSQL, dbReadOnly);

	//	hat diese Tabelle Datensätze ?
		if (m_pParams -> m_SourceSet.IsBOF ())
		{
			m_pParams -> m_SourceSet.Close ();
			m_pParams -> m_strInputTableName.Empty ();

		//	Nutzer informieren
			CString strInfo;
			AfxFormatString1 (strInfo, IDS_EMPTY_INPUT_TABLE, strTable);
			((CGakApp *) AfxGetApp ()) -> OutputMessage (strInfo);
		}
		else
			m_pParams -> m_strInputTableName = strTable;
	}
	catch (CDaoException *e)
	{
		:: DisplayDaoException (e);
		e -> Delete ();
		m_lbTables.SetCurSel (-1);
	}
	catch (CException *e)
	{
		e -> ReportError ();
		e -> Delete ();
		m_lbTables.SetCurSel (-1);
	}		

	SetWizardButton ();
}
Example #2
0
HRESULT CScript::RunMacro( LPCTSTR pszMacroName )
{
   DISPID dispid;
   COleDispatchDriver driver;
   BOOL tFound;

   ASSERT( pszMacroName != NULL );

   tFound = m_mapMacros.Lookup( pszMacroName, dispid );
   if( !tFound )
   {
	  return( DISP_E_MEMBERNOTFOUND );
   }

   driver.AttachDispatch( m_pDispatch, FALSE );
   try
   {
	  driver.InvokeHelper( dispid, DISPATCH_METHOD, VT_EMPTY, NULL, VTS_NONE );
   }
   catch( COleDispatchException* pException )
   {
	  CString strMessage;

	  AfxFormatString1( strMessage, IDS_DISPATCHEXCEPTION,
		 pException->m_strDescription );
	  AfxMessageBox( strMessage );
	  pException->Delete();
   }
   catch( COleException* pException )
   {
	  pException->Delete();
   }

   return( S_OK );
}
Example #3
0
void CuPageInformation::SetTitle (LPCTSTR  strItem, CTreeItem* pItem, CdIpmDoc* pDoc)
{
	CString strNotAvailable;
	strNotAvailable.LoadString(IDS_NOT_AVAILABLE);
	if (m_nIDTitle == 0)
	{
		m_strTitle = _T("");
		return;
	}
	if (m_strClassName == _T("CuTMSession") || 
	    m_strClassName == _T("CuTMBlockingSession") ||
	    m_strClassName == _T("CuTMSessBlockingSession") )
	{
		SERVERDATAMIN svrdta;
		ASSERT (pDoc != NULL);
		if (pDoc == NULL)
		{
			m_strTitle = _T("");
			return;
		}
		TCHAR tchszServer [100];
		LPVOID pStruct = pItem->GetPTreeItemData()? pItem->GetPTreeItemData()->GetDataPtr(): NULL;
		BOOL bOK = IPM_GetRelatedInfo (pDoc, OT_MON_SESSION, pStruct, OT_MON_SERVER, &svrdta);

		if (bOK) 
		{
			IPM_GetInfoName (pDoc, OT_MON_SERVER, (void*)&svrdta, tchszServer, sizeof (tchszServer));
			AfxFormatString2 (m_strTitle, m_nIDTitle, (LPCTSTR)tchszServer, (LPCTSTR)strItem);
		}
		else
			AfxFormatString2 (m_strTitle, m_nIDTitle, strNotAvailable, (LPCTSTR)strItem);//"<n/a>"
	}
	else
		AfxFormatString1 (m_strTitle, m_nIDTitle, (LPCTSTR)strItem);
}
BOOL CWavProgressDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	static_cast<CProgressCtrl*>(GetDlgItem(IDC_PROGRESS_BAR))->SetRange(0, 100);
	CView *pView = static_cast<CFrameWnd*>(AfxGetMainWnd())->GetActiveView();		// // //
	CSoundGen *pSoundGen = theApp.GetSoundGenerator();

	pView->Invalidate();
	pView->RedrawWindow();

	// Start rendering
	CString FileStr;
	AfxFormatString1(FileStr, IDS_WAVE_PROGRESS_FILE_FORMAT, m_sFile);
	SetDlgItemText(IDC_PROGRESS_FILE, FileStr);

	if (!pSoundGen->RenderToFile(m_sFile.GetBuffer(), m_iSongEndType, m_iSongEndParam, m_iTrack))
		EndDialog(0);

	m_dwStartTime = GetTickCount();
	SetTimer(0, 200, NULL);

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
Example #5
0
//////////////////////////////////////////////////////////////////////
//	EDIT_DDV_ASCII_MaxChars_
//
//	This function handle utf8 support for fixed field lenght.  See
//more comments above.
//////////////////////////////////////////////////////////////////////
void ArbI18N::EDIT_DDV_ASCII_MaxChars_(CDataExchange* pDX, HWND hEditCtrl, 
												int nChars)
{
	ASSERT(nChars >= 1 && nChars <= MAXIMUM_DB_STORAGE);

	// We need the text from the Edit control.  This text is non-UTF8.
	char tempStrANSI[512];
    memset(tempStrANSI, 0, 512);
	::GetWindowText(hEditCtrl, tempStrANSI, 512);
	CString value(tempStrANSI);

	if (pDX->m_bSaveAndValidate && value.GetLength() > nChars)
	{
		TCHAR szT[32];
		wsprintf(szT, _T("%d"), nChars);
		CString prompt;
		AfxFormatString1(prompt, AFX_IDP_PARSE_STRING_SIZE, szT);
		AfxMessageBox(prompt, MB_ICONEXCLAMATION, AFX_IDP_PARSE_STRING_SIZE);
		prompt.Empty(); // exception prep
		pDX->Fail();
	}
	else if ((pDX->m_idLastControl != NULL) && (pDX->m_bEditLastControl))
	{
		::SendMessage((HWND)pDX->m_idLastControl, EM_LIMITTEXT, nChars, 0);
	}
}	//EDIT_DDV_UTF8_MaxChars_
bool CRenderingDlg::FinishJob()
{
	if (Exporting()) {
		CString	s;
		s.Format(_T("%08d.bmp"), m_CurJob);
		CPathStr	Path(m_ExportFolder);
		Path.Append(m_ExportPrefix + s);
		bool	CanExport = TRUE;
		if (PathFileExists(Path)) {	// if file already exists
			CString	msg;
			AfxFormatString1(msg, IDS_FILE_OVERWRITE_PROMPT, Path);
			int	retc = AfxMessageBox(msg, MB_YESNOCANCEL | MB_DEFBUTTON2);
			if (retc == IDCANCEL) {	// if user canceled at overwrite prompt
				OnCancel();	// cancel dialog
				return(FALSE);
			}
			CanExport = (retc == IDYES);
		}
		if (CanExport) {	// if OK to export
			if (!m_View->ExportBitmap(Path)) {	// if export failed
				EndDialog(IDABORT);	// end dialog and return abort
				return(FALSE);	// error was already handled
			}
		}
	}
	if (m_Flags & CF_CREATE_THUMBS) {
		CSnapshot&	Snap = m_Hist->GetItem(m_JobList[m_CurJob]);
		Snap.m_Thumb->DeleteObject();
		m_View->CreateThumb(Snap.m_Thumb, Snap.m_ThumbFrame);
	}
	m_CurJob++;
	m_Progress.SetPos(m_CurJob);	// update progress bar
	return(TRUE);	// job is finished
}
Example #7
0
/*************
 * DESCRIPTION:	Test if value greater (or equal) minVal
 * INPUT:			pDX
 *						value		value to be tested
 *						minVal	minimum value
 *						bExclude	if TRUE -> minimum value excluded
 * OUTPUT:			-
 *************/
void AFXAPI DDV_MinFloat(CDataExchange* pDX, float const &value, float minVal, BOOL bExclude)
{
	int nID;

	if (value <= minVal)
	{
		if (!bExclude && value == minVal)
			return;	

		nID = bExclude ? IDS_DDV_MINFLOATEXC : IDS_DDV_MINFLOAT;

		if (!pDX->m_bSaveAndValidate)
		{
			TRACE0("Warning: initial dialog data is out of range.\n");
			return;         // don't stop now
		}
		TCHAR szMin[32];
		CString prompt;

		_stprintf(szMin, _T("%g"), minVal);
		AfxFormatString1(prompt, nID, szMin);

		AfxMessageBox(prompt, MB_ICONEXCLAMATION, nID);
		prompt.Empty(); // exception prep
		pDX->Fail();
	}
}
Example #8
0
CString CAbfallSet::GetDefaultSQL()
{      
	ASSERT (!m_strTableName.IsEmpty ());
	CString strSelect;
	AfxFormatString1 (strSelect, IDS_ERZEUGER_SELECT, m_strTableName);
	return strSelect;
}
Example #9
0
void CxDlgVirtualNodeEnterLogin::OnOK() 
{
	CWaitCursor doWaitCursor;
	BOOL bOK = EDBC_ModifyLogin(m_strVNodeName, m_strUserName, m_strPassword);
	if (!bOK)
	{
		CString strMessage;
		AfxFormatString1 (strMessage, IDS_ADD_SERVER_LOGIN_FAILED, m_strVNodeName);
		AfxMessageBox (strMessage, MB_OK|MB_ICONEXCLAMATION);
		return;
	}
	else 
	{
		/*
		** Test the server connection with the username and password.
		*/
		STATUS bSuccess = INGRESII_NodeCheckConnection(m_strVNodeName);
		if (bSuccess)
		{
			CString strMsg;
			strMsg.Format(_T("Failed to connect to server %s."), (LPCTSTR)m_strVNodeName);
			AfxMessageBox(strMsg, MB_OK | MB_ICONEXCLAMATION);
			m_strUserName = _T("");
			m_strPassword = _T("");
			EDBC_ModifyLogin(m_strVNodeName, m_strUserName, m_strPassword);
			UpdateData (FALSE);
			m_cUserName.SetFocus();
			m_cOK.EnableWindow (FALSE);
			return;
		}
	}

	CDialog::OnOK();
}
Example #10
0
BOOL CAboutDlg::OnInitDialog()
{
	CString aboutString;

#ifdef WIP
	aboutString.Format(_T("FamiTracker version %i.%i.%i beta %i"), VERSION_MAJ, VERSION_MIN, VERSION_REV, VERSION_WIP);
#else
	CString str;
	str.Format(_T("%i.%i.%i"), VERSION_MAJ, VERSION_MIN, VERSION_REV);
	AfxFormatString1(aboutString, IDS_ABOUT_VERSION_FORMAT, str);
#endif

	SetDlgItemText(IDC_ABOUT1, aboutString);

	m_pMail = new CLinkLabel(LINK_MAIL);
	m_pWeb = new CLinkLabel(LINK_WEB);

	m_pMail->SubclassDlgItem(IDC_MAIL, this);
	m_pWeb->SubclassDlgItem(IDC_WEBPAGE, this);

	m_pHead = new CHead();
	m_pHead->SubclassDlgItem(IDC_HEAD, this);

	LOGFONT LogFont;
	CFont *pFont;
	
	EnableToolTips(TRUE);

	m_wndToolTip.Create(this, TTS_ALWAYSTIP);
	m_wndToolTip.Activate(TRUE);

	m_wndToolTip.AddTool(m_pMail, IDS_ABOUT_TOOLTIP_MAIL);
	m_wndToolTip.AddTool(m_pWeb, IDS_ABOUT_TOOLTIP_WEB);

	pFont = m_pMail->GetFont();
	pFont->GetLogFont(&LogFont);
	LogFont.lfUnderline = 1;
	m_pLinkFont = new CFont();
	m_pLinkFont->CreateFontIndirect(&LogFont);
	m_pMail->SetFont(m_pLinkFont);
	m_pWeb->SetFont(m_pLinkFont);

	
	CStatic *pStatic = static_cast<CStatic*>(GetDlgItem(IDC_ABOUT1));
	CFont *pOldFont = pStatic->GetFont();
	LOGFONT NewLogFont;
	pOldFont->GetLogFont(&NewLogFont);
	NewLogFont.lfWeight = FW_BOLD;
	m_pBoldFont = new CFont();
	m_pTitleFont = new CFont();
	m_pBoldFont->CreateFontIndirect(&NewLogFont);
	NewLogFont.lfHeight = 18;
//	NewLogFont.lfUnderline = TRUE;
	m_pTitleFont->CreateFontIndirect(&NewLogFont);
	static_cast<CStatic*>(GetDlgItem(IDC_ABOUT1))->SetFont(m_pTitleFont);
	static_cast<CStatic*>(GetDlgItem(IDC_ABOUT2))->SetFont(m_pBoldFont);
	static_cast<CStatic*>(GetDlgItem(IDC_ABOUT3))->SetFont(m_pBoldFont);
	
	return TRUE;
}
Example #11
0
void CChordEaseApp::WinHelp(DWORD dwData, UINT nCmd) 
{
//printf("dwData=%d:%d nCmd=%d\n", HIWORD(dwData), LOWORD(dwData), nCmd);
	CPathStr	HelpPath(GetAppFolder());
	HelpPath.Append(CString(m_pszAppName) + _T(".chm"));
	HWND	hMainWnd = GetMain()->m_hWnd;
	UINT	ResID = LOWORD(dwData);
	int	HelpID = FindHelpID(ResID);
	HWND	hWnd = 0;	// assume failure
	if (HelpID)	// if context help ID was found
		hWnd = ::HtmlHelp(hMainWnd, HelpPath, HH_HELP_CONTEXT, HelpID);
	if (!hWnd) {	// if context help wasn't available or failed
		hWnd = ::HtmlHelp(hMainWnd, HelpPath, HH_DISPLAY_TOC, 0);	// show contents
		if (!hWnd) {	// if help file not found
			CString	s;
			AfxFormatString1(s, IDS_APP_HELP_FILE_MISSING, HelpPath);
			AfxMessageBox(s);
			return;
		}
	}
	// ThreadBoost DLL boosts priority of MIDI input callbacks, but also boosts
	// other normal threads, including HtmlHelp's, which is counterproductive
	if (m_ThreadBoost.IsLoaded()) {	// if boosting normal priority threads
		DWORD	ThreadID = GetWindowThreadProcessId(hWnd, NULL);
		// obtain set info access to HtmlHelp's thread and set its priority to normal
		CSafeHandle	hThread(OpenThread(THREAD_SET_INFORMATION, FALSE, ThreadID));
		if (hThread == NULL || !::SetThreadPriority(hThread, THREAD_PRIORITY_NORMAL))
			AfxMessageBox(GetLastErrorString());
	}
	m_HelpInit = TRUE;
}
Example #12
0
/*

Custom DDX/DDV processing
=========================

This file provides the extra processing which enables the "minimum length" for
CStrings in the Class Wizard. 


If you have to rebuild the winforms.CLW file, then you must insert the following
lines in the first section of that file (ie. in the [General Info] section).
They are inserted at the end of the section.


; ClassWizard DDX information for custom DDX functions
ExtraDDXCount=2
ExtraDDX1=E;;String with min and max;CString;;MinMaxString;CString with a minimum and maximum length;MinMaxString;M&inimum length;d;Ma&ximum length;d
ExtraDDX2=M;;String with min and max;CString;;MinMaxCBString;CString with a minimum and maximum length;MinMaxCBString;M&inimum length;d;Ma&ximum length;d


*/
void AFXAPI DDV_MinMaxString(CDataExchange* pDX, CString& value, int nMinChars, int nMaxChars)
{

  value.TrimLeft ();
  value.TrimRight ();

	if (pDX->m_bSaveAndValidate && value.GetLength() < nMinChars)
	{
		TCHAR szT[32];
    if (nMinChars == 1)
		  TMessageBox("This field may not be blank", MB_ICONEXCLAMATION);
    else
      {
		  wsprintf(szT, _T("%d"), nMinChars);
		  CString prompt;
		  AfxFormatString1(prompt, IDS_MIN_STRING_SIZE, szT);
		  AfxMessageBox(prompt, MB_ICONEXCLAMATION, AFX_IDP_PARSE_STRING_SIZE);
   		prompt.Empty(); // exception prep
      }
		pDX->Fail();
	}
 
// now test maximum length

  DDV_MaxChars (pDX, value, nMaxChars);

}
Example #13
0
BOOL COleDocument::SaveModified()
{
	// determine if necessary to discard changes
	if (::InSendMessage())
	{
		POSITION pos = GetStartPosition();
		COleClientItem* pItem;
		while ((pItem = GetNextClientItem(pos)) != NULL)
		{
			ASSERT(pItem->m_lpObject != NULL);
			SCODE sc = pItem->m_lpObject->IsUpToDate();
			if (sc != OLE_E_NOTRUNNING && FAILED(sc))
			{
				// inside inter-app SendMessage limits the user's choices
				CString name = m_strPathName;
				if (name.IsEmpty())
					VERIFY(name.LoadString(AFX_IDS_UNTITLED));

				CString prompt;
				AfxFormatString1(prompt, AFX_IDP_ASK_TO_DISCARD, name);
				return AfxMessageBox(prompt, MB_OKCANCEL|MB_DEFBUTTON2,
					AFX_IDP_ASK_TO_DISCARD) == IDOK;
			}
		}
	}

	// sometimes items change without a notification, so we have to
	//  update the document's modified flag before calling
	//  CDocument::SaveModified.
	UpdateModifiedFlag();

	return CDocument::SaveModified();
}
void CFTPTransferDlg::HandleThreadErrorWithLastError(UINT nIDError, DWORD dwLastError)
{
	//Form the error string to report
	CString sError;
	
	DWORD dwErr = dwLastError;
	if (dwErr == 0)
		dwErr = ::GetLastError();
	if (dwErr == ERROR_INTERNET_EXTENDED_ERROR)
	{
		DWORD dwInetError;
		DWORD dwSize=0;
		::InternetGetLastResponseInfo(&dwInetError, NULL, &dwSize);
		TCHAR* pszResponse = new TCHAR[dwSize+1];
		::InternetGetLastResponseInfo(&dwInetError, pszResponse, &dwSize);
		pszResponse[dwSize] = _T('\0');
		sError = pszResponse;
		sError = _T("\n") + sError; //Add a line feed between the normal message
		//and the verbose error message
		delete [] pszResponse;
	}
	else
		sError.Format(_T("%d"), dwErr);
	AfxFormatString1(m_sError, nIDError, sError);
	
	//Delete the file being downloaded to if it is present
	if (m_bDownload)
	{
		m_LocalFile.Close();
		::DeleteFile(m_sLocalFile);
	}
	
	PostMessage(WM_FTPTRANSFER_THREAD_FINISHED, 1);
}
Example #15
0
BOOL CGetFileNameDialog::OnFileNameOK()
{
  BOOL rVal = CFileDialog::OnFileNameOK();

  if (!rVal && ((m_ofn.Flags & OFN_EXPLORER) == 0) || ((GetVersion() & 0xff) < 4))
  //if the filename passed the parent tests
  //then put it throught our own tests
  {
    //check for overwrite if that flag is used, since the file open
    //common dialog will not bother looking at this flag
    if (m_ofn.Flags & OFN_OVERWRITEPROMPT)
    {
      //Retrieve the filename selected
      TCHAR sPath[_MAX_PATH];
      CommDlg_OpenSave_GetFilePath(GetParent()->m_hWnd, sPath, _MAX_PATH);

      //check to see if the file already exists
      CFileStatus fs;
      if (CFile::GetStatus(sPath, fs))
      {
        CString sMessage;
        AfxFormatString1(sMessage, IDS_DDX_GF_OVERWRITE_PROMPT, sPath);

        //ensure the title is the same as the common dialog caption
        CString sCaption;
        GetParent()->GetWindowText(sCaption);
        rVal = (MessageBox(sMessage, sCaption, MB_YESNO | MB_ICONQUESTION) != IDYES);
      }
    }
  }


  return rVal;
}
Example #16
0
void CGetFileNameDialog::OnOK()
{
  BOOL bCallParent = TRUE;

  if ( ((m_ofn.Flags & OFN_EXPLORER) == 0) || ((GetVersion() & 0xff) < 4) )
  {
    //check for overwrite if that flag is used
    if (m_ofn.Flags & OFN_OVERWRITEPROMPT)
    {
      //Retrieve the filename selected
      TCHAR sPath[_MAX_PATH];
      GetDlgItemText(edt1, sPath, _MAX_PATH);

      //check to see if the file already exists
      CFileStatus fs;
      if (CFile::GetStatus(sPath, fs))
      {
        CString sMessage;
        AfxFormatString1(sMessage, IDS_DDX_GF_OVERWRITE_PROMPT, sPath);

        //ensure the title is the same as the common dialog caption
        CString sCaption;
        GetWindowText(sCaption);
        bCallParent = (MessageBox(sMessage, sCaption, MB_YESNO | MB_ICONQUESTION) == IDYES);
      }
    }
  }

  if (bCallParent)
    CFileDialog::OnOK();
}
Example #17
0
void CxDlgVirtualNodeLogin::OnOK() 
{
	if (m_strPassword != m_strConfirmPassword)
	{
		CString strPasswordError;
		if (!strPasswordError.LoadString (IDS_E_PLEASE_RETYPE_PASSWORD))
			strPasswordError = _T("Password is not correct.\nPlease retype the password");
		AfxMessageBox (strPasswordError, MB_OK|MB_ICONEXCLAMATION);
		return;
	}
	//
	// Call the low level to add or change the definition of Virtual Node's Login Password
	HRESULT hErr = NOERROR;
	try
	{
		CWaitCursor doWaitCursor;
		CaNodeDataAccess nodeAccess;
		nodeAccess.InitNodeList();
		CaNodeLogin login (m_strVNodeName, m_strUserName, m_strPassword, m_bPrivate);

		if (!m_bAlter)
		{
			hErr = VNODE_LoginAdd (&login);
		}
		else
		{
			CaNodeLogin loginOld (m_strOldVNodeName, m_strOldUserName, m_strOldPassword, m_bOldPrivate);
			hErr = VNODE_LoginAlter (&loginOld, &login);
		}
		if (hErr != NOERROR)
		{
			CString strMessage;
			if (m_bAlter)
#ifdef EDBC
				AfxFormatString1 (strMessage, IDS_ALTER_SERVER_LOGIN_FAILED, m_strOldVNodeName);
#else
				AfxFormatString1 (strMessage, IDS_ALTER_NODE_LOGIN_FAILED, m_strOldVNodeName);
#endif
			else
#ifdef EDBC
				AfxFormatString1 (strMessage, IDS_ADD_SERVER_LOGIN_FAILED, m_strVNodeName);
#else
				AfxFormatString1 (strMessage, IDS_ADD_NODE_LOGIN_FAILED, m_strVNodeName);
#endif
			AfxMessageBox (strMessage, MB_OK|MB_ICONEXCLAMATION);
			return;
		}
Example #18
0
void CuDlgDBEventPane01::OnRefresh()
{
    TRACE0 ("CuDlgDBEventPane01::OnRefresh() ...\n");
    int     nCount, i, index =CB_ERR;
    CString strItem;
    CView* pView = (CView*)GetParent();
    ASSERT (pView);
    CDbeventDoc* pDoc = (CDbeventDoc*)pView->GetDocument();
    ASSERT (pDoc);
    //
    // Refresh data of this Window
    // Refresh the DB Events of One Database.
    CString strNone;
    strNone.LoadString (IDS_DATABASE_NONE);
    if (pDoc->m_strDBName == strNone || pDoc->m_strDBName == "")
        return;
    CCheckListBox list;
    list.Create (WS_CHILD|LBS_HASSTRINGS|LBS_OWNERDRAWFIXED, CRect (0,0, 10, 10), this, (UINT)-1);
    ASSERT (IsWindow (list.m_hWnd));
    InitializeDBEvent (m_strCurrentDB, &list);
    
    nCount = m_cListDBEvent.GetCount();
    for (i = 0; i < nCount; i++)
    {
        if (m_cListDBEvent.GetCheck(i) == 1)
        {
            m_cListDBEvent.GetText (i, strItem);
            index = list.FindStringExact (-1, strItem);
            if (index == LB_ERR)
            {
                CString msg;
                AfxFormatString1 (msg, IDS_DBECHECKED_HASBEEN_REMOVED, (LPCTSTR)strItem);
                BfxMessageBox (msg);
            }
            else
            {
                list.SetCheck (index, 1);
            }
        }
    }
    CleanListBox (&m_cListDBEvent);
    m_cListDBEvent.ResetContent ();
    nCount = list.GetCount();
    for (i = 0; i < nCount; i++)
    {
        list.GetText (i, strItem);
        index = m_cListDBEvent.AddString (strItem);
        if (index != LB_ERR)
        {
            LPTSTR lpszOwner = (LPTSTR)list.GetItemData (i);
            m_cListDBEvent.SetItemData (i, (DWORD)lpszOwner);
            if (list.GetCheck (i) == 1)
                m_cListDBEvent.SetCheck (index, 1);
        }
    }
}
Example #19
0
void AFXAPI AfxFailMaxChars(CDataExchange* pDX, int nChars)
{
	TCHAR lpszTemp[32];
	wsprintf(lpszTemp, _T("%d"), nChars);
	CString prompt;
	AfxFormatString1(prompt, AFX_IDP_PARSE_STRING_SIZE, lpszTemp);
	AfxMessageBox(prompt, MB_ICONEXCLAMATION, AFX_IDP_PARSE_STRING_SIZE);
	prompt.Empty(); // exception prep
	pDX->Fail();
}
Example #20
0
BOOL CKaiDoc::SaveModified()
{
    // TODO: Add your specialized code here and/or call the base class
    if (pco_Doc_->b_IsImported())
    {
        // Adapted from MFC code: doccore.cpp
	    CString cstr_prompt;
	    AfxFormatString1 (cstr_prompt, AFX_IDP_ASK_TO_SAVE, GetPathName());
	    switch (AfxMessageBox ( cstr_prompt, MB_YESNOCANCEL, AFX_IDP_ASK_TO_SAVE))
	    {
	        case IDCANCEL:
            {
		        return FALSE;       // don't continue
            }
	        case IDYES:
            {
                OnFileSaveAs();
		        break;
            }
	        case IDNO:
            {
		        // If not saving changes, revert the document
		        break;
            }

	        default:
            {
		        ATLASSERT(FALSE);
		        break;
            }
	    }

//        OnFileSaveAs();
        return TRUE;
    }

    if (!pco_GetUndoStack()->b_EventsAvailable())
    {
        return TRUE;
    }

    SetTitle (pco_Doc_->str_Title_.data());
    BOOL ui_ = CDocument::SaveModified();
    if (ui_)
    {
        SetModifiedFlag (FALSE);
    }
    else
    {
        SetTitle (CString (pco_Doc_->str_Title_.data()) + _T("*"));
    }

    return ui_;
}
Example #21
0
void CxDlgVirtualNodeData::OnOK() 
{
	//
	// Call the low level to add or alter the VNode Data
	//
	// Call the low level to add or change the definition of Virtual Node.
	HRESULT hErr = NOERROR;
	try
	{
		CWaitCursor doWaitCursor;
		CaNodeDataAccess nodeAccess;
		nodeAccess.InitNodeList();
		CaNodeConnectData connectData(m_strVNodeName, m_strRemoteAddress, m_strProtocol, m_strListenAddress, m_bPrivate);
		if (!m_bAlter)
		{
			hErr = VNODE_ConnectionAdd  (&connectData);

		}
		else
		{
			CaNodeConnectData connectDataOld(m_strOldVNodeName, m_strOldRemoteAddress, m_strOldProtocol, m_strOldListenAddress, m_bOldPrivate);
			hErr = VNODE_ConnectionAlter(&connectDataOld, &connectData);
		}
		if (hErr != NOERROR)
		{
			CString strMessage;
			if (m_bAlter)
#ifdef EDBC
				AfxFormatString1 (strMessage, IDS_ALTER_SERVER_DATA_FAILED, m_strOldVNodeName);
#else
				AfxFormatString1 (strMessage, IDS_ALTER_NODE_DATA_FAILED, m_strOldVNodeName);
#endif
			else
#ifdef EDBC
				AfxFormatString1 (strMessage, IDS_ADD_SERVER_DATA_FAILED, m_strVNodeName);
#else
				AfxFormatString1 (strMessage, IDS_ADD_NODE_DATA_FAILED, m_strVNodeName);
#endif
			AfxMessageBox (strMessage, MB_OK|MB_ICONEXCLAMATION);
			return;
		}
Example #22
0
void CMainFrame::OnSelChangePalette()
{
	CString strText;
	CString strItem;
	CComboBox* pCBox = (CComboBox*)m_wndDlgBar.GetDlgItem(IDC_PALETTE);
	int nIndex = pCBox->GetCurSel();
	if (nIndex == CB_ERR)
		return;
	pCBox->GetLBText(nIndex, strItem);
	AfxFormatString1(strText, IDS_SELECTED_PROMPT, (LPCTSTR)strItem);
	SetMessageText(strText);
}
Example #23
0
void CWordPadDoc::ReportSaveLoadException(LPCTSTR lpszPathName,
	CException* e, BOOL bSaving, UINT nIDP)
{
	if (!m_bDeferErrors && e != NULL)
	{
		ASSERT_VALID(e);
		if (e->IsKindOf(RUNTIME_CLASS(CFileException)))
		{
			switch (((CFileException*)e)->m_cause)
			{
			case CFileException::fileNotFound:
			case CFileException::badPath:
				nIDP = AFX_IDP_FAILED_INVALID_PATH;
				break;
			case CFileException::diskFull:
				nIDP = AFX_IDP_FAILED_DISK_FULL;
				break;
			case CFileException::accessDenied:
				nIDP = bSaving ? AFX_IDP_FAILED_ACCESS_WRITE :
						AFX_IDP_FAILED_ACCESS_READ;
				if (((CFileException*)e)->m_lOsError == ERROR_WRITE_PROTECT)
					nIDP = IDS_WRITEPROTECT;
				break;
			case CFileException::tooManyOpenFiles:
				nIDP = IDS_TOOMANYFILES;
				break;
			case CFileException::directoryFull:
				nIDP = IDS_DIRFULL;
				break;
			case CFileException::sharingViolation:
				nIDP = IDS_SHAREVIOLATION;
				break;
			case CFileException::lockViolation:
			case CFileException::badSeek:
			case CFileException::genericException:
			case CFileException::invalidFile:
			case CFileException::hardIO:
				nIDP = bSaving ? AFX_IDP_FAILED_IO_ERROR_WRITE :
						AFX_IDP_FAILED_IO_ERROR_READ;
				break;
			default:
				break;
			}
			CString prompt;
			AfxFormatString1(prompt, nIDP, lpszPathName);
			AfxMessageBox(prompt, MB_ICONEXCLAMATION, nIDP);
			return;
		}
	}
	CRichEditDoc::ReportSaveLoadException(lpszPathName, e, bSaving, nIDP);
	return;
}
void CFTPTransferDlg::SetPercentage(int nPercentage)
{
	//Change the progress control
	m_ctrlProgress.SetPos(nPercentage);
	
	//Change the caption text
	CString sPercentage;
	sPercentage.Format(_T("%d"), nPercentage);
	CString sCaption;
	AfxFormatString1(sCaption, IDS_FTPTRANSFER_PERCENTAGE, sPercentage);
//	AfxFormatString2(sCaption, IDS_FTPTRANSFER_PERCENTAGE, sPercentage, m_sRemoteFile);
	SetWindowText(sCaption);
}
Example #25
0
/******************************************************************************************
BOOL CIntChessDoc::SaveModified()
作者      : tangjs520       创建日期: 2004-9-29
函数名    : CIntChessDoc::SaveModified
返回值    : BOOL
参数列表  : 无
描述      : 
调用关系  : 
被调用关系: 
备注      : 
修改记录  : 
******************************************************************************************/
BOOL CIntChessDoc::SaveModified()
{
    // TODO: Add your specialized code here and/or call the base class
    if (!IsModified())
    {
        return TRUE;        // ok to continue
    }

    // get name/title of document
    CString name;
    if (m_strPathName.IsEmpty())
    {
        // get name based on caption
        name = m_strTitle;
        if (name.IsEmpty())
        {
            VERIFY(name.LoadString(AFX_IDS_UNTITLED));
        }
    }
    else
    {
        // get name based on file title of path name
        name = m_strPathName;
    }

    CString prompt;
    AfxFormatString1(prompt, AFX_IDP_ASK_TO_SAVE, name);
    switch (AfxMessageBox(prompt, MB_YESNOCANCEL, AFX_IDP_ASK_TO_SAVE))
    {
    case IDCANCEL:
        return FALSE;       // don't continue

    case IDYES:
        // If so, either Save or Update, as appropriate
        if (!DoFileSave())
        {
            return FALSE;       // don't continue
        }
        break;

    case IDNO:
        // If not saving changes, revert the document
        break;

    default:
        ASSERT(FALSE);
        break;
    }

    return TRUE;    // keep going
}
void CFTPTransferDlg::SetTransferRate(double KbPerSecond)
{
	CString sRate;
	if (KbPerSecond < 1)
	{
		CString sBytesPerSecond;
		sBytesPerSecond.Format(_T("%0.0f"), KbPerSecond*1024);
		AfxFormatString1(sRate, IDS_FTPTRANSFER_BYTESPERSECOND, sBytesPerSecond);
	}
	else if (KbPerSecond < 10)
	{
		CString sKiloBytesPerSecond;
		sKiloBytesPerSecond.Format(_T("%0.2f"), KbPerSecond);
		AfxFormatString1(sRate, IDS_FTPTRANSFER_KILOBYTESPERSECOND, sKiloBytesPerSecond);
	}
	else
	{
		CString sKiloBytesPerSecond;
		sKiloBytesPerSecond.Format(_T("%0.0f"), KbPerSecond);
		AfxFormatString1(sRate, IDS_FTPTRANSFER_KILOBYTESPERSECOND, sKiloBytesPerSecond);
	}
	m_ctrlTransferRate.SetWindowText(sRate);
}
Example #27
0
void CHttpDownloadDlg::SetTransferRate(double KbPerSecond)
{
	CString sRate;
	if (KbPerSecond < 1)
	{
		CString sBytesPerSecond;
		sBytesPerSecond.Format(_T("%0.0f"), KbPerSecond*1024);
		AfxFormatString1(sRate, IDS_HTTPDOWNLOAD_BYTESPERSECOND, sBytesPerSecond);
	}
	else if (KbPerSecond < 10)
	{
		CString sKiloBytesPerSecond;
		sKiloBytesPerSecond.Format(_T("%0.2f"), KbPerSecond);
		AfxFormatString1(sRate, IDS_HTTPDOWNLOAD_KILOBYTESPERSECOND, sKiloBytesPerSecond);
	}
	else
	{
		CString sKiloBytesPerSecond;
		sKiloBytesPerSecond.Format(_T("%0.0f"), KbPerSecond);
		AfxFormatString1(sRate, IDS_HTTPDOWNLOAD_KILOBYTESPERSECOND, sKiloBytesPerSecond);
	}
	//m_ctrlTransferRate.SetWindowText(sRate);
}
Example #28
0
//***********************************************************************
// Function: CDynaMenuDoc::GetMessageString()
//
// Purpose:
//    GetMessageString formats and returns a string containing the
//    message text to display in a status bar for any of the color
//    selection commands.
//
// Parameters:
//    nID        -- command ID to get message for
//    strMessage -- buffer to fill with message
//
// Returns:
//    TRUE if nID is a color selection command ID, otherwise FALSE.
//
// Comments:
//    If the function returns FALSE, strMessage is not changed
//
//***********************************************************************
BOOL CDynaMenuDoc::GetMessageString(UINT nID, CString& strMessage)
{
	for (int i = 0; i < NUM_TEXTCOLOR; i++)
	{
		if (m_aColorDef[i].m_nID == nID)
		{
			CString strColor;
			strColor.LoadString(m_aColorDef[i].m_nString);
			AfxFormatString1(strMessage, IDS_COLORHELPFMT, strColor);
			return TRUE;
		}
	}
	return FALSE;
}
Example #29
0
void CMlsPrint::OnCreatePrintingDialog()
{
	m_pPrintingDialog = new CMlsPrintingDialog(AFX_IDD_PRINTDLG, m_pParent);
	
	if (m_pPrintingDialog != NULL)
	{
		CString docTitle;
		GetTitle(docTitle);
		m_pPrintingDialog->SetDlgItemText(AFX_IDC_PRINT_DOCNAME, docTitle);
		m_pPrintingDialog->SetDlgItemText(AFX_IDC_PRINT_PRINTERNAME, m_pInfo->m_pPD->GetDeviceName());

		CString strPort;
		AfxFormatString1(strPort, AFX_IDS_PRINTONPORT, m_pInfo->m_pPD->GetPortName());
		m_pPrintingDialog->SetDlgItemText(AFX_IDC_PRINT_PORTNAME, strPort);
		m_pPrintingDialog->ShowWindow(SW_SHOW);
	}
}
Example #30
0
CString CSearchSet::GetDefaultSQL()
{
	CString strTableName;
	strTableName = ((CGakApp *)(AfxGetApp ())) -> ErzeugerDefaultSQL ();

	CString strSelect;
	if (m_strSearch.IsEmpty ())
	//	SELECT Nummer FROM %1 ORDER BY Nummer	
		AfxFormatString1 (strSelect, IDS_SELECT_NUMMER_WW, strTableName);
	else
	//	SELECT Nummer FROM %1 WHERE %2 ORDER BY Nummer
		AfxFormatString2 (strSelect, IDS_SELECT_NUMBER, strTableName, m_strSearch);

	return strSelect;

	// return strTableName;		// tableset
}