1

My program has two forms. At a certain point while running, both forms will be shown - one atop of the other. I want to be able to maximize the bottom form while focused on the front one.

I played around a bit with TForm.BorderStyle := bsNone and ShowWindowAsync(Handle, SW_MAXIMIZE) as it seems to be the only thing that maximizes to fullscreen.

This, however, maximizes the current and wrong form.

Is there any way to completely maximize (to fullscreen) a form from inside another one?

Pickle
  • 33
  • 1
  • 7
  • Try `TheOtherForm.WindowState := wsMaximized;` where `TheOtherForm` is the `Name` of the form, not its type. Alternatively, call `ShowWindowAsync(TheOtherForm.Handle, SW_MAXIMIZE);` **Neither of these, though, makes the window grow to cover the taskbar on my Windows 10 system.** – Tom Brunberg Oct 29 '22 at 22:40
  • If you can explain why you specifically want to hide (prevent use of?) the taskbar, there might be other ways to achieve your goal. – Tom Brunberg Oct 30 '22 at 07:34
  • So by "_completely maximize_" you just mean [fullscreen](https://en.wikipedia.org/wiki/Fullscreen)? – AmigoJack Oct 30 '22 at 07:44
  • Yes @AmigoJack, fullscreen is correct. While writing I just forgot that the word exists. – Pickle Oct 30 '22 at 14:06

1 Answers1

2

To answer my own question:

With the help of a comment made by Tom Brunberg, I have found that although ShowWindowAsync(TheOtherForm.Handle, SW_MAXIMIZE) does not make the form completely fullscreen, it works on removing the "Async".

Thus,

TForm.BorderStyle := bsNone;
ShowWindow(TheOtherForm.Handle, SW_MAXIMIZE);

is a working solution in this case.

Pickle
  • 33
  • 1
  • 7