Solved

CBitmapButton  SubclassDlgItem throwing an assert

Posted on 2009-06-29
4
749 Views
Last Modified: 2013-12-27
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??
0
Comment
Question by:Wanting2LearnMan
  • 2
  • 2
4 Comments
 

Author Comment

by:Wanting2LearnMan
ID: 24741377
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???
0
 
LVL 24

Accepted Solution

by:
alexey_gusev earned 500 total points
ID: 24741389
YES!!!! :)

look at that line and the very next:

      ASSERT(FromHandlePermanent(hWndNew) == NULL);
            // must not already be in permanent map <-- HERE
0
 

Author Comment

by:Wanting2LearnMan
ID: 24741410
I have took this out:
DDX_Control(pDX, IDC_BUTTON_1, m_button1);

and now its ok.



Thanks
0
 
LVL 24

Expert Comment

by:alexey_gusev
ID: 24741434
to be honest, I'd do the opposite :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
only14 challenge 19 68
ShiftLeft challenge 21 76
withoutTen challenge 14 100
Message not shown 5 33
Preface: This article is part of a series focused on cross platform mobile app development (specifically Android and iOS) using the Alloy framework and Titanium Studio made by Appcelerator (https://www.appcelerator.com/). This article presumes a wor…
Once again I push the limits of my phone.  An introduction to the Android Google Now Launcher.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now