Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6645219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:15:36+00:00 2026-05-26T00:15:36+00:00

I got some warnings by using pure virtual interfaces on some MFC CWnd derived

  • 0

I got some warnings by using pure virtual interfaces on some MFC CWnd derived objects through multiple inheritance. I believe it’s caused by defining the methods which need to be implemented for the message map.

warning C4407: cast between different pointer to member representations, compiler may generate incorrect code

That sounds like a bit more than a warning, more like something that might cause heap corruption. So is there another way to do something similar to below that won’t cause the MFC dynamic downcast macros to choke anymore than usual?

class ISomeInterface
{
public:
     virtual LRESULT OnSomeRegisteredMessage(WPARAM wp, LPARAM lp) = 0;
};

class CSomeCoolWnd : public CWnd, public ISomeInterface
{
public:
     LRESULT OnSomeRegisteredMessage(WPARAM wp, LPARAM lp);
};

BEGIN_MESSAGE_MAP(CSomeCoolWnd , CWnd)
     ON_REGISTERED_MESSAGE(WM_USER_DEFINED, &CSomeCoolWnd::OnSomeRegisteredMessage)
END_MESSAGE_MAP()

The only thing I’ve come up with is commenting out the message handlers from the interfaces and leaving comments telling the consumer that they should implement them. However it would be nice to enforce that through a compiler error rather than letting them use an interface and get unexpected results at runtime from things being missing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:15:36+00:00Added an answer on May 26, 2026 at 12:15 am

    An excellent description of the different representations of pointer-to-member values can be found at the article Member Function Pointers and the Fastest Possible C++ Delegates. Essentially, all the different inheritance types can require the use of different member function pointer representations. This is compiler-specific and the article talks about a number of different compilers (up to 2005 when the article was written).

    Evidently your use of multiple inheritance with virtual functions may require a different representation than a simple pointer-to-member function. There’s probably a cast somewhere in ON_REGISTERED_MESSAGE() that isn’t visible in the code you posted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got some tests that need to count the number of warnings raised by
I've got some problems using Maven on this ready-to-use project: http://wiki.javaforum.hu/display/ANDROIDSOAP/Home Basically, I just
I've got some code that I've been using successfully for some years to implement
Got some code that is not mine and its producing this warning atm: iehtmlwin.cpp(264)
I got some problems with finding a bug in php/mysql application, and I wonder
I got some legacy code with that caption spread out as comment almost in
I got some legacy code that has this: <?PHP if(isset($_GET['pagina'])==homepage) { ?> HtmlCode1 <?php
I got some files, after an egrep command, like egrep -l -r '(this|that|those)' *
I got some weird error with response.redirect() and the project wasn't building at all..
I got some sample code from the net here: http://www.javadb.com/sending-a-post-request-with-parameters-from-a-java-class That works fine. It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.