Solved

CBitmapButton  SubclassDlgItem throwing an assert

Posted on 2009-06-29
4
774 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I recently asked a question (http://www.experts-exchange.com/Programming/Smartphones/Android/Q_28684946.html) about Computer Inventory applications for Mobile Devices.  I was specifically interested in an app I could use on my android phone.  The be…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

739 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