CPropertySheet用法

ooicc 2014-08-05 07:21:32
我贴代码吧,省的说不清:
加的东西几乎没有,为了测试
CMyPropertySheet 头文件
class CMyPropertySheet : public CPropertySheet
{
DECLARE_DYNAMIC(CMyPropertySheet)

public:
CMyPropertySheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
CMyPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
virtual ~CMyPropertySheet();
C1Page m_page;//向导自动生成,一个东西都没加,对话框模版也啥都没加
protected:
DECLARE_MESSAGE_MAP()
};
CMyPropertySheet cpp文件
IMPLEMENT_DYNAMIC(CMyPropertySheet, CPropertySheet)

CMyPropertySheet::CMyPropertySheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
AddPage(&m_page);
}

CMyPropertySheet::CMyPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
AddPage(&m_page);
}

CMyPropertySheet::~CMyPropertySheet()
{
}


BEGIN_MESSAGE_MAP(CMyPropertySheet, CPropertySheet)
END_MESSAGE_MAP()


// CMyPropertySheet 消息处理程序
然后,第一次进入Propertysheet会写入访问冲突:
CMyPropertySheet dlg(_T("Options"));
dlg.DoModal();
这样的代码,问题在哪。。。。要疯了

再一个,我在MyPropertyPage里面放一个MFC ColorButton Control,MyPropertySheet窗口出不来,DoModal直接返回,进不了ContinueModal的循环,MFC ColorButton Control要咋用啊,有啥特别的吗?
...全文
148 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
ooicc 2014-08-17
  • 打赏
  • 举报
回复
引用 4 楼 u011561131 的回复:
[quote=引用 3 楼 oyljerry 的回复:] [quote=引用 2 楼 u011561131 的回复:] [quote=引用 1 楼 gaohl 的回复:] 我这里测设这段代码没问题
我有多次做实验! CMyPropertyPage对应的资源里面用dialog没问题,用IDD_PROPPAGE_LARGE,有问题,至于用其他的medium,small PropertyPage做资源会不会有问题,我不想玩了。。。 MSDN上是这么说的: CPropertySheet::DoModal Remarks When a property page is created from its corresponding dialog resource, it can cause a first-chance exception. This results from the property page changing the style of the dialog resource to the required style before the page is created. Because resources are generally read-only, this causes an exception. The system handles the exception, and makes a copy of the modified resource. The first-chance exception can therefore be ignored. 只有第一次使用才出问题,后面不再出现。 坑逼! 还有MFC colorbutton的问题。。。我受不了了[/quote] 看来MSDN很好的描述了你的问题,不过一般都是用Dialog吧[/quote] 我手贱,用的都是page。。。 还有Mfc colorbutton control,我在dialog资源里面扔一个这个,propertysheet就出不来了,domodal进不了循环[/quote] 微软sample的用法是资源里面放CButton,然后ddx_control关联资源和CMFCColorButton,表瞎折腾,没用的
ooicc 2014-08-05
  • 打赏
  • 举报
回复
引用 3 楼 oyljerry 的回复:
[quote=引用 2 楼 u011561131 的回复:] [quote=引用 1 楼 gaohl 的回复:] 我这里测设这段代码没问题
我有多次做实验! CMyPropertyPage对应的资源里面用dialog没问题,用IDD_PROPPAGE_LARGE,有问题,至于用其他的medium,small PropertyPage做资源会不会有问题,我不想玩了。。。 MSDN上是这么说的: CPropertySheet::DoModal Remarks When a property page is created from its corresponding dialog resource, it can cause a first-chance exception. This results from the property page changing the style of the dialog resource to the required style before the page is created. Because resources are generally read-only, this causes an exception. The system handles the exception, and makes a copy of the modified resource. The first-chance exception can therefore be ignored. 只有第一次使用才出问题,后面不再出现。 坑逼! 还有MFC colorbutton的问题。。。我受不了了[/quote] 看来MSDN很好的描述了你的问题,不过一般都是用Dialog吧[/quote] 我手贱,用的都是page。。。 还有Mfc colorbutton control,我在dialog资源里面扔一个这个,propertysheet就出不来了,domodal进不了循环
oyljerry 2014-08-05
  • 打赏
  • 举报
回复
引用 2 楼 u011561131 的回复:
[quote=引用 1 楼 gaohl 的回复:] 我这里测设这段代码没问题
我有多次做实验! CMyPropertyPage对应的资源里面用dialog没问题,用IDD_PROPPAGE_LARGE,有问题,至于用其他的medium,small PropertyPage做资源会不会有问题,我不想玩了。。。 MSDN上是这么说的: CPropertySheet::DoModal Remarks When a property page is created from its corresponding dialog resource, it can cause a first-chance exception. This results from the property page changing the style of the dialog resource to the required style before the page is created. Because resources are generally read-only, this causes an exception. The system handles the exception, and makes a copy of the modified resource. The first-chance exception can therefore be ignored. 只有第一次使用才出问题,后面不再出现。 坑逼! 还有MFC colorbutton的问题。。。我受不了了[/quote] 看来MSDN很好的描述了你的问题,不过一般都是用Dialog吧
ooicc 2014-08-05
  • 打赏
  • 举报
回复
引用 1 楼 gaohl 的回复:
我这里测设这段代码没问题
我有多次做实验! CMyPropertyPage对应的资源里面用dialog没问题,用IDD_PROPPAGE_LARGE,有问题,至于用其他的medium,small PropertyPage做资源会不会有问题,我不想玩了。。。 MSDN上是这么说的: CPropertySheet::DoModal Remarks When a property page is created from its corresponding dialog resource, it can cause a first-chance exception. This results from the property page changing the style of the dialog resource to the required style before the page is created. Because resources are generally read-only, this causes an exception. The system handles the exception, and makes a copy of the modified resource. The first-chance exception can therefore be ignored. 只有第一次使用才出问题,后面不再出现。 坑逼! 还有MFC colorbutton的问题。。。我受不了了
量子 2014-08-05
  • 打赏
  • 举报
回复
我这里测设这段代码没问题

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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