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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:22:18+00:00 2026-06-18T16:22:18+00:00

My application has one main form and I have a button on that form

  • 0

My application has one main form and I have a button on that form to close/exit the application. Currently it’s written with a call to Windows to close the handle:

SendMessage(Handle, WM_CLOSE, 0, 0);

But I’m wondering what’s the harm in using:

formName.Close;

What’s the proper usage here? Is there any reason to use the SendMessage?

  • 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-18T16:22:19+00:00Added an answer on June 18, 2026 at 4:22 pm

    They do exactly the same thing. In fact, in Forms.pas you find

    procedure WMClose(var Message: TWMClose); message WM_CLOSE;
    
    ...
    
    implementation
    
    ...
    
    procedure TCustomForm.WMClose(var Message: TWMClose);
    begin
      Close;
    end;
    

    showing that the WM_CLOSE message simply translates to Self.Close.

    Generally, you should use Close if you can, since that is more Delphi-ish and shorter.

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

Sidebar

Related Questions

I have an application that has two threads. The first one (the main thread)
I have a Visual C# 2010 application, and it has one main form called
I have one main windows form and within that form I have custom controls
I have a web application that has one set of files used by 50+
I have an ASP.NET MVC application that has one part where I dont really
I have a WinForms application. the main form is has a lot of controls
In my WPF application, I have a ListView on the main form that displays
In an application I'm developing, I have a main form that simply sits there
I also have a desktop application written in Windows Forms that is a middling
I have a title bar in my application. And the title bar has one

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.