How can I get the Delphi IDE's Main Form?

喜夏-厌秋 提交于 2019-12-06 01:26:41

The IDE's main form is Application.MainForm. My quick test design package:

procedure DoStuff(Form: TCustomForm);
var
  S: string;
begin
  S := Form.Caption;
  Form.Caption := S + ' - this one';
  try
    ShowMessage(Format('%s [%s] on monitor %d', [Form.Name, Form.ClassName, Form.Monitor.MonitorNum]));
  finally
    Form.Caption := S;
  end;
end;

initialization
  DoStuff(Application.MainForm);

This in my case displays "AppBuilder [TAppBuilder] on monitor 0" and I can see the " - this one" suffix in the main form's caption. What doesn't seem to work in your case?

IIRC the main form is called TAppBuilder, so something like FindWindow('TAppBuilder',nil) might be a starting point for you.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!