ciderpress/app/UseSelectionDialog.cpp
Andy McFadden d42b9c6dc0 Add CheckedLoadString
The static analyzer was annoyed that the return value from calls to
CString::LoadString() was being ignored.  This adds a wrapper
function that checks the value and logs a failure message if the
string can't be found.
2014-12-16 11:04:31 -08:00

61 lines
1.5 KiB
C++

/*
* CiderPress
* Copyright (C) 2007 by faddenSoft, LLC. All Rights Reserved.
* See the file LICENSE for distribution terms.
*/
#include "stdafx.h"
#include "UseSelectionDialog.h"
BEGIN_MESSAGE_MAP(UseSelectionDialog, CDialog)
ON_WM_HELPINFO()
//ON_COMMAND(IDHELP, OnHelp)
END_MESSAGE_MAP()
BOOL UseSelectionDialog::OnInitDialog(void)
{
CString str;
CString selStr;
CWnd* pWnd;
CDialog::OnInitDialog();
/* grab the radio button with the selection count */
pWnd = GetDlgItem(IDC_USE_SELECTED);
ASSERT(pWnd != NULL);
/* set the string using a string table entry */
if (fSelectedCount == 1) {
CheckedLoadString(&str, fSelCountID);
pWnd->SetWindowText(str);
} else {
CheckedLoadString(&str, fSelCountsID);
selStr.Format((LPCWSTR) str, fSelectedCount);
pWnd->SetWindowText(selStr);
if (fSelectedCount == 0)
pWnd->EnableWindow(FALSE);
}
/* set the other strings */
CheckedLoadString(&str, fTitleID);
SetWindowText(str);
pWnd = GetDlgItem(IDC_USE_ALL);
ASSERT(pWnd != NULL);
CheckedLoadString(&str, fAllID);
pWnd->SetWindowText(str);
pWnd = GetDlgItem(IDOK);
ASSERT(pWnd != NULL);
CheckedLoadString(&str, fOkLabelID);
pWnd->SetWindowText(str);
return TRUE;
}
void UseSelectionDialog::DoDataExchange(CDataExchange* pDX)
{
DDX_Radio(pDX, IDC_USE_SELECTED, fFilesToAction);
}