本文整理汇总了C++中CGeneralMsgBox::AfxMessageBox方法的典型用法代码示例。如果您正苦于以下问题:C++ CGeneralMsgBox::AfxMessageBox方法的具体用法?C++ CGeneralMsgBox::AfxMessageBox怎么用?C++ CGeneralMsgBox::AfxMessageBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGeneralMsgBox
的用法示例。
在下文中一共展示了CGeneralMsgBox::AfxMessageBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DDV_CheckMinMax
void AFXAPI CFilterPasswordDlg::DDV_CheckMinMax(CDataExchange* pDX,
const int &num,
const int &min, const int &max)
{
if (m_rule != PWSMatch::MR_WILLEXPIRE)
return;
CGeneralMsgBox gmb;
if (pDX->m_bSaveAndValidate) {
if (min != -1 && num < min) {
CString cs_text;
cs_text.Format(IDS_NUMTOOSMALL, min);
gmb.AfxMessageBox(cs_text);
pDX->Fail();
return;
}
if (max != -1 && num > max) {
CString cs_text;
cs_text.Format(IDS_NUMTOOLARGE, max);
gmb.AfxMessageBox(cs_text);
pDX->Fail();
return;
}
}
}
示例2: OnOK
void CPasskeyEntry::OnOK()
{
UpdateData(TRUE);
if (m_filespec.IsEmpty()) {
m_status = TAR_OPEN_NODB;
CPWDialog::OnCancel();
return;
}
CGeneralMsgBox gmb;
if (m_passkey.IsEmpty()) {
gmb.AfxMessageBox(IDS_CANNOTBEBLANK);
m_pctlPasskey->SetFocus();
return;
}
if (!pws_os::FileExists(m_filespec.GetString())) {
gmb.AfxMessageBox(IDS_FILEPATHNOTFOUND);
if (m_MRU_combo.IsWindowVisible())
m_MRU_combo.SetFocus();
return;
}
ProcessPhrase();
}
示例3: DDV_CheckDates
void AFXAPI CFilterDateDlg::DDV_CheckDates(CDataExchange* pDX,
const int &num1, const int &num2)
{
if (m_datetype == 0 /* Absolute */)
return;
CGeneralMsgBox gmb;
if (pDX->m_bSaveAndValidate) {
if (m_rule == PWSMatch::MR_BETWEEN && num1 >= num2) {
gmb.AfxMessageBox(IDS_NUM1NOTLTNUM2);
pDX->Fail();
return;
}
if (num1 == -3650 && m_rule == PWSMatch::MR_LT) {
gmb.AfxMessageBox(IDS_CANTBELESSTHANMIN);
pDX->Fail();
return;
}
if (num1 == 3650 && m_rule == PWSMatch::MR_GT) {
gmb.AfxMessageBox(IDS_CANTBEGREATERTHANMAX);
pDX->Fail();
return;
}
if (num1 == 3650 && m_rule == PWSMatch::MR_BETWEEN) {
gmb.AfxMessageBox(IDS_NUM1CANTBEMAX);
pDX->Fail();
return;
}
}
}
示例4: OnMakePronounceable
void CPasswordPolicyDlg::OnMakePronounceable()
{
UnselectNamedPolicy();
UpdateData(TRUE);
if (m_PWEasyVision && m_PWMakePronounceable) {
CGeneralMsgBox gmb;
((CButton*)GetDlgItem(IDC_PRONOUNCEABLE))->SetCheck(FALSE);
gmb.AfxMessageBox(IDS_PROVISMUTUALLYEXCL);
m_PWMakePronounceable = FALSE;
return;
}
const bool bChecked = (IsDlgButtonChecked(IDC_PRONOUNCEABLE) == BST_CHECKED);
if (m_PWUseLowercase == FALSE && m_PWUseUppercase == FALSE) {
CGeneralMsgBox gmb;
((CButton*)GetDlgItem(IDC_PRONOUNCEABLE))->SetCheck(FALSE);
gmb.AfxMessageBox(IDS_PR_MUSTHAVECHARACTERS);
m_PWMakePronounceable = FALSE;
return;
}
do_easyorpronounceable(bChecked ? EVPR_PR : EVPR_NONE);
do_reset_symbols(false);
// Do not use UpdateData(FALSE) here or
// all the good work in "do_easyorpronounceable" will be undone
}
示例5: OnOK
void CCreateShortcutDlg::OnOK()
{
if (UpdateData(TRUE) == FALSE)
return;
CGeneralMsgBox gmb;
m_group.EmptyIfOnlyWhiteSpace();
m_title.EmptyIfOnlyWhiteSpace();
m_username.EmptyIfOnlyWhiteSpace();
//Check that data is valid
if (m_title.IsEmpty()) {
gmb.AfxMessageBox(IDS_MUSTHAVETITLE);
((CEdit*)GetDlgItem(IDC_TITLE))->SetFocus();
return;
}
if (!m_group.IsEmpty() && m_group[0] == '.') {
gmb.AfxMessageBox(IDS_DOTINVALID);
((CEdit*)GetDlgItem(IDC_GROUP))->SetFocus();
return;
}
// If there is a matching entry in our list, tell the user to try again.
if (GetMainDlg()->Find(m_group, m_title, m_username) != app.GetMainDlg()->End()) {
gmb.AfxMessageBox(IDS_ENTRYEXISTS, MB_OK | MB_ICONASTERISK);
((CEdit*)GetDlgItem(IDC_TITLE))->SetSel(MAKEWORD(-1, 0));
((CEdit*)GetDlgItem(IDC_TITLE))->SetFocus();
return;
}
//End check
CPWDialog::OnOK();
}
示例6: VerifyFilters
bool CPWFiltersDlg::VerifyFilters()
{
// Verify that the active filters have a criterion set
if (UpdateData(TRUE) == FALSE)
return false;
// First non-History/non-Policy filters on the main filter dialog
vFilterRows *pvFilterRows(NULL);
switch (m_iType) {
case DFTYPE_MAIN:
pvFilterRows = &m_pfilters->vMfldata;
break;
case DFTYPE_PWHISTORY:
pvFilterRows = &m_pfilters->vHfldata;
break;
case DFTYPE_PWPOLICY:
pvFilterRows = &m_pfilters->vPfldata;
break;
case DFTYPE_ATTACHMENT:
pvFilterRows = &m_pfilters->vAfldata;
break;
default:
VERIFY(0);
}
CGeneralMsgBox gmb;
CString cs_text;
int iHistory(-1), iPolicy(-1), iAttachment(-1);
FilterValidator fv(cs_text, iHistory, iPolicy, iAttachment);
if (find_if(pvFilterRows->begin(), pvFilterRows->end(), fv) !=
pvFilterRows->end()) {
gmb.AfxMessageBox(cs_text);
return false;
}
if (m_iType == DFTYPE_MAIN) {
// Now check that the filters were correct on
// History/Policy/Attachment sub-filter dialogs
if (m_FilterLC.IsPWHIST_Set() && !m_FilterLC.IsHistoryGood()) {
cs_text.Format(IDS_FILTERINCOMPLETE, iHistory + 1);
gmb.AfxMessageBox(cs_text);
return false;
}
if (m_FilterLC.IsPOLICY_Set() && !m_FilterLC.IsPolicyGood()) {
cs_text.Format(IDS_FILTERINCOMPLETE, iPolicy + 1);
gmb.AfxMessageBox(cs_text);
return false;
}
if (m_FilterLC.IsAttachment_Set() && !m_FilterLC.IsAttachmentGood()) {
cs_text.Format(IDS_FILTERINCOMPLETE, iPolicy + 1);
gmb.AfxMessageBox(cs_text);
return false;
}
}
return true;
}
示例7: ProcessPhrase
void CPasskeyEntry::ProcessPhrase()
{
CGeneralMsgBox gmb;
switch (GetMainDlg()->CheckPasskey(LPCWSTR(m_filespec), LPCWSTR(m_passkey))) {
case PWScore::SUCCESS: {
// OnOK clears the passkey, so we save it
const CSecString save_passkey = m_passkey;
// Try to change read-only state if user changed checkbox:
// r/w -> r-o always succeeds
// r-o -> r/w may fail
// Note that if file is read-only, m_bForceReadOnly is true -> checkbox
// is disabled -> don't need to worry about that.
if ((m_index == GCP_RESTORE || m_index == GCP_WITHEXIT) &&
(m_PKE_ReadOnly == TRUE) == pws_os::IsLockedFile(LPCWSTR(m_filespec))) {
GetMainDlg()->ChangeMode(false); // false means
// "don't prompt use for password", as we just got it.
}
CPWDialog::OnOK();
m_passkey = save_passkey;
}
break;
case PWScore::WRONG_PASSWORD:
if (m_tries++ >= 2) { // too many tries
CString cs_toomany;
cs_toomany.Format(IDS_TOOMANYTRIES, m_tries);
gmb.AfxMessageBox(cs_toomany);
}
else { // try again
gmb.AfxMessageBox(m_index == GCP_CHANGEMODE ? IDS_BADPASSKEY : IDS_INCORRECTKEY);
}
m_pctlPasskey->SetSel(MAKEWORD(-1, 0));
m_pctlPasskey->SetFocus();
break;
case PWScore::READ_FAIL:
gmb.AfxMessageBox(IDSC_FILE_UNREADABLE);
CPWDialog::OnCancel();
break;
case PWScore::TRUNCATED_FILE:
gmb.AfxMessageBox(IDSC_FILE_TRUNCATED);
CPWDialog::OnCancel();
break;
default:
ASSERT(0);
gmb.AfxMessageBox(IDSC_UNKNOWN_ERROR);
CPWDialog::OnCancel();
break;
}
}
示例8: OnOK
void CSetDBID::OnOK()
{
UpdateData(TRUE);
// Has user changed the index?
if (m_iInitialDBIndex != m_iDBIndex) {
// Has user disabled index feature?
if (m_iDBIndex != 0) {
// Try to get this index
wchar_t szName[MAX_PATH];
CreateUniqueName(UNIQUE_PWS_GUID, szName, MAX_PATH, SI_TRUSTEE_UNIQUE);
CString csUserSBIndex;
csUserSBIndex.Format(L"%s:DBI:%02d", static_cast<LPCWSTR>(szName), m_iDBIndex);
m_hMutexDBIndex = CreateMutex(NULL, FALSE, csUserSBIndex);
DWORD dwerr = ::GetLastError();
if (dwerr == ERROR_ALREADY_EXISTS || dwerr == ERROR_ACCESS_DENIED) {
CGeneralMsgBox gmb;
gmb.AfxMessageBox(IDS_DBIDINUSE, MB_OK | MB_ICONEXCLAMATION);
m_edtSBIndex.SetFocus();
return;
}
}
}
CPWDialog::EndDialog(m_iDBIndex);
}
示例9: DDV_CheckImpDelimiter
void AFXAPI DDV_CheckImpDelimiter(CDataExchange* pDX, const CString &delimiter)
{
if (pDX->m_bSaveAndValidate) {
CGeneralMsgBox gmb;
if (delimiter.IsEmpty()) {
gmb.AfxMessageBox(IDS_NEEDDELIMITER);
pDX->Fail();
return;
}
if (delimiter[0] == '"') {
gmb.AfxMessageBox(IDS_INVALIDDELIMITER);
pDX->Fail();
return;
}
}
}
示例10: OnKillActive
BOOL COptionsBackup::OnKillActive()
{
COptions_PropertyPage::OnKillActive();
if (m_BackupBeforeSave != TRUE)
return TRUE;
CGeneralMsgBox gmb;
// Check that correct fields are non-blank.
if (m_BackupPrefix == 1 && m_UserBackupPrefix.IsEmpty()) {
gmb.AfxMessageBox(IDS_OPTBACKUPPREF);
((CEdit*)GetDlgItem(IDC_USERBACKUPPREFIXVALUE))->SetFocus();
return FALSE;
}
if (m_BackupLocation == 1) {
if (m_UserBackupOtherLocation.IsEmpty()) {
gmb.AfxMessageBox(IDS_OPTBACKUPLOCATION);
((CEdit*)GetDlgItem(IDC_USERBACKUPOTHRLOCATIONVALUE))->SetFocus();
return FALSE;
}
if (m_UserBackupOtherLocation.Right(1) != L"\\") {
m_UserBackupOtherLocation += L"\\";
UpdateData(FALSE);
}
if (PathIsDirectory(m_UserBackupOtherLocation) == FALSE) {
gmb.AfxMessageBox(IDS_OPTBACKUPNOLOC);
((CEdit*)GetDlgItem(IDC_USERBACKUPOTHRLOCATIONVALUE))->SetFocus();
return FALSE;
}
}
if (m_BackupSuffix == PWSprefs::BKSFX_IncNumber &&
((m_MaxNumIncBackups < 1) || (m_MaxNumIncBackups > 999))) {
gmb.AfxMessageBox(IDS_OPTBACKUPMAXNUM);
((CEdit*)GetDlgItem(IDC_BACKUPMAXINC))->SetFocus();
return FALSE;
}
//End check
return TRUE;
}
示例11: OnOK
void CCryptKeyEntry::OnOK()
{
UpdateData(TRUE);
CGeneralMsgBox gmb;
if (m_encrypt && (m_cryptkey1 != m_cryptkey2)) {
gmb.AfxMessageBox(IDS_ENTRIESDONOTMATCH);
((CEdit*)GetDlgItem(IDC_CRYPTKEY2))->SetFocus();
return;
}
if (m_cryptkey1.IsEmpty()) {
gmb.AfxMessageBox(IDS_ENTERKEYANDVERIFY);
((CEdit*)GetDlgItem(IDC_CRYPTKEY1))->SetFocus();
return;
}
CDialog::OnOK();
}
示例12: YubiInitialize
void CPasskeySetup::YubiInitialize()
{
#ifndef NO_YUBI
CGeneralMsgBox gmb;
CYubiCfgDlg ycd(this, m_core);
unsigned char sk[CYubiCfgDlg::YUBI_SK_LEN];
pws_os::GetRandomData(sk, CYubiCfgDlg::YUBI_SK_LEN);
if (ycd.WriteYubiSK(sk) == YKLIB_OK) {
m_core.SetYubiSK(sk);
gmb.AfxMessageBox(IDS_YUBI_INIT_SUCCESS,
MB_OK | MB_ICONINFORMATION);
PostMessage(WM_COMMAND, IDC_YUBIKEY_BTN);
} else {
gmb.AfxMessageBox(IDS_YUBI_INIT_FAILED,
MB_OK | MB_ICONERROR);
}
#endif /* NO_YUBI */
}
示例13: YubiFailed
void CPasskeySetup::YubiFailed()
{
CGeneralMsgBox gmb;
INT_PTR rc = gmb.AfxMessageBox(IDS_YUBI_UNINITIALIZED,
MB_YESNO | MB_ICONQUESTION);
if (rc == IDYES) {
YubiInitialize();
}
}
示例14: OnOK
void CPasskeySetup::OnOK()
{
UpdateData(TRUE);
CGeneralMsgBox gmb;
if (m_passkey != m_verify) {
gmb.AfxMessageBox(IDS_ENTRIESDONOTMATCH);
((CEdit*)GetDlgItem(IDC_VERIFY))->SetFocus();
return;
}
if (m_passkey.IsEmpty()) {
gmb.AfxMessageBox(IDS_ENTERKEYANDVERIFY);
((CEdit*)GetDlgItem(IDC_PASSKEY))->SetFocus();
return;
}
// Vox populi vox dei - folks want the ability to use a weak
// passphrase, best we can do is warn them...
// If someone want to build a version that insists on proper
// passphrases, then just define the preprocessor macro
// PWS_FORCE_STRONG_PASSPHRASE in the build properties/Makefile
// (also used in CPasskeyChangeDlg)
#ifndef _DEBUG // for debug, we want no checks at all, to save time
StringX errmess;
if (!CPasswordCharPool::CheckPassword(m_passkey, errmess)) {
CString cs_msg, cs_text;
cs_msg.Format(IDS_WEAKPASSPHRASE, static_cast<LPCWSTR>(errmess.c_str()));
#ifndef PWS_FORCE_STRONG_PASSPHRASE
cs_text.LoadString(IDS_USEITANYWAY);
cs_msg += cs_text;
INT_PTR rc = gmb.AfxMessageBox(cs_msg, NULL, MB_YESNO | MB_ICONSTOP);
if (rc == IDNO)
return;
#else
cs_text.LoadString(IDS_TRYANOTHER);
cs_msg += cs_text;
gmb.AfxMessageBox(cs_msg, NULL, MB_OK | MB_ICONSTOP);
return;
#endif // PWS_FORCE_STRONG_PASSPHRASE
}
#endif // _DEBUG
CPKBaseDlg::OnOK();
}
示例15: OnAttImport
void CAddEdit_Attachment::OnAttImport()
{
CString filter;
CSimpleArray<GUID> aguidFileTypes;
HRESULT hr;
UpdateData(TRUE);
if (m_AttFileName.IsEmpty()) {
// Ask user for file name - annoyingly - returned string is all in upper case!
// Remove last separator
const CString cs_allimages(MAKEINTRESOURCE(IDS_ALL_IMAGE_FILES));
const DWORD dwExclude = CImage::excludeOther;
hr = m_AttImage.GetImporterFilterString(filter, aguidFileTypes, cs_allimages, dwExclude);
ASSERT(hr >= 0);
// Make better visually
filter = filter.Right(filter.GetLength() - cs_allimages.GetLength());
filter.MakeLower();
filter = cs_allimages + filter;
// Remove last separator to add the all files
filter = filter.Left(filter.GetLength() - 1);
// Add "All files"
const CString cs_allfiles(MAKEINTRESOURCE(IDS_FDF_ALL));
filter.Append(cs_allfiles);
CFileDialog fileDlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST, filter, this);
if (fileDlg.DoModal() == IDCANCEL)
return;
m_AttFileName = CSecString(fileDlg.GetPathName());
} else {
if (!pws_os::FileExists(LPCWSTR(m_AttFileName))) {
CGeneralMsgBox gmb;
gmb.AfxMessageBox(IDS_ATTACHMENT_NOTFOUND);
return;
}
}
// Get file information
struct _stati64 info;
VERIFY(_wstati64(m_AttFileName, &info) == 0);
m_csFileCTime = PWSUtil::ConvertToDateTimeString(info.st_ctime, PWSUtil::TMC_LOCALE).c_str();
m_csFileMTime = PWSUtil::ConvertToDateTimeString(info.st_mtime, PWSUtil::TMC_LOCALE).c_str();
ShowPreview();
m_ae_psh->SetChanged(true);
Invalidate();
UpdateControls();
UpdateData(FALSE);
UpdateWindow();
}