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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:49:22+00:00 2026-06-09T17:49:22+00:00

I am not sure when Delphi creates the main form’s child components. In my

  • 0

I am not sure when Delphi creates the main form’s child components.

In my TMainForm.FormCreate() I am invoking TIdTCPClient.Connect() and TIdTCPClient.SendCmd(). My program shows up in the Windows TAsk manager, but I don’t see the GUI. However, if I disconnect the Ethernet cable & start the program, the GUI appears.

I am guessing this is because I am trying to invoke methods of a child componenet of the main form in the main form’s FormCraete() method.

Oops, I forgot to say – the TIdTCPClient is placed on the form at design time, it is not created dynamically at runtime.

Any comment? Thanks in advance

  • 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-09T17:49:24+00:00Added an answer on June 9, 2026 at 5:49 pm

    The problem is that Indy is blocking, and therefore stops the Create from continuing until the connection is made or times out.

    You can fix this by using a custom message that you post to your form in the OnCreate event, that will delay it until the form has been displayed:

    const
      UM_DOCONNECTION = WM_USER + 1;
    
    type
      TForm1=class(TForm)
         ...
      private
        procedure UmDoConnection(var Msg: TMessage); message UM_DOCONNECTION;
        ...
      end;
    
      implementation
    
      procedure TForm1.FormCreate(Sender: TObject);
      begin
        PostMessage(Handle, UM_DOCONNECTION, 0, 0);
        // Other stuff
      end;
    
      procedure TForm1.UmDoConnection(var Msg: TMessage);
      begin
        IdTCPClient.Connect;
        IdTCPClient.SendCmd(...);
      end;
    

    The best way, of course, would be to move your Indy stuff into it’s own thread so it has no connection to the main thread.

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

Sidebar

Related Questions

I'm not sure if this is possible in Delphi. I've looked around and can't
I have a media application (written in Delphi 2010 but I am not sure
What is the Delphi equivalent of unsigned char** ' in C i'm not sure
Not sure whats going on here, or what could be the integer in this
Not sure if im just being stupid or something but here goes i work
Not sure how to ask this, but i'll give it a try: I have
Not sure if this is a big deal. But wondering why when the site
not sure what I'm missing here, but i keep getting the error. SQLSTATE[HY093]: Invalid
Not sure what I am doing wrong. The results I get from the Accelerate
Not sure if this is the correct Stack Exchange website but here goes.. A

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.