Delphi: What is Application.Handle?

前端 未结 3 1576
耶瑟儿~
耶瑟儿~ 2020-12-07 13:26

What is TApplication.Handle?

  • Where does it come from?
  • Why does it exist?
  • And most importantly: why do all forms have it as th
3条回答
  •  无人及你
    2020-12-07 13:59

    All VCL apps have a "hidden" top level window called Application. This is created automatically on application startup. Amongst other things it is the main windows message handler for VCL - hence Application.ProcessMessages.

    Having the apps top level window hidden does cause some strange things, noticeably the incomplete system menu that shows in the task bar, and incorrect thumb nail windows in Vista. Later versions of Delphi correct this.

    However, not all windows must have it as a parent, Windows just tends to work better if it is. However, any form created with Application.CreateForm will have it as the parent, and it will also be owned by the Application object. As they are owned, they will be freed once Application is freed. This happen behind the scenes in Forms.DoneApplication

提交回复
热议问题