Link to home
Start Free TrialLog in
Avatar of Wanting2LearnMan
Wanting2LearnManFlag for United Kingdom of Great Britain and Northern Ireland

asked on

CBitmapButton SubclassDlgItem throwing an assert

I have an MFC button on my dialog.  I wich to use bitmap buttons to give it a nice look.  When I do the following:

CBitmapButton bmpOpt1;
m_bmpOpt1.SubclassDlgItem( IDC_BUTTON_1, this );
m_bmpOpt1.LoadBitmaps(IDB_BITMAP_GREENNEW, IDB_BITMAP_GREENNEW, 0, IDB_XPBTNMENUDIS_BITMAP);

I get an assert error on the second line above:
m_bmpOpt1.SubclassDlgItem( IDC_BUTTON_1, this );

The assert error is:
Debug Assert Failed
File: f:\sp\vctools\vclibsce\ship\atlmfc\src\mfc\wincore.cpp Line 375;
Abort | Retry | Ignore


Why is this??
Avatar of Wanting2LearnMan
Wanting2LearnMan
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

I have just realised that I have a handler for this button already:

DDX_Control(pDX, IDC_BUTTON_1, m_button1);

could this be causing problems???
ASKER CERTIFIED SOLUTION
Avatar of alexey_gusev
alexey_gusev
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have took this out:
DDX_Control(pDX, IDC_BUTTON_1, m_button1);

and now its ok.



Thanks
to be honest, I'd do the opposite :)