如果截获属性页的确定按钮事件

kim_fu 2003-12-03 07:34:03
我做了个属性页,在其中的某个页中输入一些属性,当属性不符合要求时候,在用户单击确定时我希望给出提示,并不关闭属性页窗口。我该怎么做?
...全文
94 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
COOL099 2003-12-04
  • 打赏
  • 举报
回复
根據是哪個Sheet 重載OnWizardNext或是OnWizardFinish.
如.
LRESULT CWizard3::OnWizardNext()
{
// TODO: Add your specialized code here and/or call the base class
UpdateData(true);
if (m_DistFolder.GetLength()>0)
return CPropertyPage::OnWizardNext();
else
//Add you tip message here!
return -1;
}
greensofter 2003-12-04
  • 打赏
  • 举报
回复
自己重载OnOK()
eagle_xmw 2003-12-04
  • 打赏
  • 举报
回复
楼上的,你看错题目了。
他要的是“在用户单击确定时我希望给出提示,并不关闭属性页窗口”,你给出的是模拟按下
某个按钮的函数
BuZhang_AP97091 2003-12-04
  • 打赏
  • 举报
回复
来自MSDN的文档,也许可行吧
BuZhang_AP97091 2003-12-04
  • 打赏
  • 举报
回复
CPropertySheet::PressButton
BOOL PressButton( int nButton );

Return Value

Nonzero if successful; otherwise zero.

Parameters

nButton

nButton : Identifies the button to be pressed. This parameter can be one of the following values:

PSBTN_BACK Chooses the Back button.


PSBTN_NEXT Chooses the Next button.


PSBTN_FINISH Chooses the Finish button.


PSBTN_OK Chooses the OK button.


PSBTN_APPLYNOW Chooses the Apply Now button.


PSBTN_CANCEL Chooses the Cancel button.


PSBTN_HELP Chooses the Help button.
Remarks

Call this member function to simulate the choice of the specified button in a property sheet. SeePSM_PRESSBUTTON for more information about the Windows SDK Pressbutton message.

Example

// Simulate the selection of OK and Cancel buttons when Alt+K and
// Alt+C are pressed. CMyPropertySheet is a CPropertySheet-derived
// class.
BOOL CMyPropertySheet::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST)
{
BOOL altkey = GetKeyState(VK_MENU) < 0;
if (altkey)
{
BOOL handled = TRUE;
switch(toupper(pMsg->wParam))
{
case 'C': // for Alt+C - Cancel button
PressButton(PSBTN_CANCEL); // or EndDialog(IDCANCEL);
break;

case 'K': // for Alt+K - OK button
PressButton(PSBTN_OK); // or EndDialog(IDOK);
break;

default:
handled = FALSE;
}

if (handled)
return TRUE;
}
}

return CPropertySheet::PreTranslateMessage(pMsg);
}

eagle_xmw 2003-12-04
  • 打赏
  • 举报
回复
重载对应CPropertyPage的OnOK函数,如果属性不符合要求,不执行CPropertyPage::OnOK();
符合要求就执行CPropertyPage::OnOK();
kim_fu 2003-12-04
  • 打赏
  • 举报
回复
帮忙啊。

16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧