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 7770613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:27:01+00:00 2026-06-01T16:27:01+00:00

I’ve got this C++ Builder 2009 app. It’s not desperate – it’s a demo,

  • 0

I’ve got this C++ Builder 2009 app. It’s not desperate – it’s a demo, but it’s driving me to Scotch. I’m now so full of single malt that I have to ask for help.

This app has a main form and some other stuff that all works. I have no reason to think that there’s anything wrong with it. I added another form, ‘TfoPNGload’, and added a few components – nothing unusual. I took it out of the auto-create list so instances could be created on-demand.

As a test, I plonked a SpeedButton on the main form and, in the click, created an instance of the ‘TfoPNGload’ form and Show()ed it:

void __fastcall TForm1::SpeedButton1Click(TObject *Sender)
{
  myPNGform=new TfoPNGload(NULL);
  myPNGform->Show();
}

This worked fine too – I click on the button, a form popped up.

Everything is normal.

I added a message-handler and things became abnormal even before I sent any messages. I added a function and the macro thingy to make it a message-handler:

class TfoPNGload : public TForm
{
__published:    // IDE-managed Components
    TImage *Image1;
    TPanel *Panel1;
    TSpeedButton *SpeedButton1;
    TTimer *tiSlideShow;
    TLabel *Label1;
    void __fastcall tiSlideShowTimer(TObject *Sender);
    void __fastcall FormCreate(TObject *Sender);
private:
    PNGload *myLoad;
    void __fastcall filesLoaded(TObject *Sender);
protected:
public:     // User declarations
    __fastcall TfoPNGload(TComponent* Owner);


    MESSAGE void __fastcall WMAPP(TMessage& msg);

    BEGIN_MESSAGE_MAP
    MESSAGE_HANDLER(WM_APP, TMessage, WMAPP)
    END_MESSAGE_MAP(TfoPNGload)

    vector<PNGtask*> *PNGresult;
    int vecSize;
};

Then, when I clicked on the button to create the form, up pops the classic ‘Stack overflow’ messagebox!

If I comment out the macros:

//      BEGIN_MESSAGE_MAP
//      MESSAGE_HANDLER(WM_APP, TMessage, WMAPP)
//      END_MESSAGE_MAP(TfoPNGload)

..the form is created just fine!

It’s not like I’m posting any messages yet – just processing the macros seems to generate the overflow on form creation. The WMAPP function is empty anyway.

Anyone seen anything like this or, even better, fixed it?

If push comes to shove, I have a workaround – using the same macros in the main form does work, so I could post my stuff there instead and then call into the ‘TfoPNGload’ form. It would probably work but it makes a mess of my code structure which, TBH, is difficult enough to follow as it is :((

Rgds,
Martin

  • 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-06-01T16:27:03+00:00Added an answer on June 1, 2026 at 4:27 pm

    I suspect this line:

    END_MESSAGE_MAP(TfoPNGload)
    

    Should specify the base class:

    END_MESSAGE_MAP(TForm)
    

    The message map macros generate a virtual function called Dispatch or something like that which contains a big switch for handling the mapping cases. The END_MESSAGE_MAP(TfoPNGLoad) macro will generate the default: case of the switch which will call TfoPNGLoad::Dispatch. But, guess what, that is the very function being defined by the macros: so runaway direct recursion occurs.

    You want to pass the superclass name TForm to the end macro so that it generates a default: case routing to the base class Dispatch.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.