Solved

CBitmapButton  SubclassDlgItem throwing an assert

Posted on 2009-06-29
4
755 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Arduino EDI - Programming language 3 94
Microsoft C++ code failing in executable that worked 9 98
Problem to open Excel file 15 133
Why isn't object file created? 6 59
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
In this article we will discuss all things related to StageFright bug, the most vulnerable bug of android devices.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

773 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