Knobik
Knobik

Reputation: 383

Removing firemonkey from Windows taskbar

Is there a way, to remove my firemonkey application form Windows XP/vista/7 taskbar? There is no info when i google.

The problem:

How to hide the form that is located in a dll from the Windows taskbar.

Upvotes: 4

Views: 2607

Answers (1)

Richard Stelling
Richard Stelling

Reputation: 25665

NB: Talibek answered his own question within the question, for clarity I have moved it here.

You need to get your main form handle (Form1.Handle), because there is no Application.handle in firemonkey, then convert it with FmxHandleToHWND (FMX.Platform.Win) to normal window handle. From your host application, you need to retrive that handle (you can export a function with it) and do this:

  h := GetHandle();

  ShowWindow(h, SW_HIDE);
  SetWindowLong(h, GWL_EXSTYLE, GetWindowLong(h, GWL_EXSTYLE) or 
      WS_EX_TOOLWINDOW);
  ShowWindow(h, SW_SHOW);

Retrieving handle:

class function TForm1.returnHandle(): integer;
begin
  result := FmxHandleToHWND(Form1.Handle);
end;

Of course, the Application.MainFormOnTaskBar property needs to be set to true so the form can handle the application.

Hope it helps somebody.

Upvotes: 2

Related Questions