本文整理匯總了C++中AfxFormatString1函數的典型用法代碼示例。如果您正苦於以下問題:C++ AfxFormatString1函數的具體用法?C++ AfxFormatString1怎麽用?C++ AfxFormatString1使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AfxFormatString1函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: ASSERT
// 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 ();
}
示例2: ASSERT
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 );
}
示例3: AfxFormatString1
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
}
示例4: ASSERT
//////////////////////////////////////////////////////////////////////
// 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_
示例5: Path
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
}
示例6: DDV_MinFloat
/*************
* 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();
}
}
示例7: ASSERT
CString CAbfallSet::GetDefaultSQL()
{
ASSERT (!m_strTableName.IsEmpty ());
CString strSelect;
AfxFormatString1 (strSelect, IDS_ERZEUGER_SELECT, m_strTableName);
return strSelect;
}
示例8: AfxFormatString1
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;
}
示例9: HelpPath
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;
}
示例10: file
/*
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);
}
示例11: GetStartPosition
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();
}
示例12: _T
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);
}
示例13: AfxFailMaxChars
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();
}
示例14: AfxFormatString1
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_;
}
示例15: AfxFormatString1
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);
}