Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App staying behind taskbar when starting in fullscreen [closed]

Tags:

This is the code I'm using:

BorderStyle := bsNone;
WindowState := wsMaximized;

My problem is that the application won't cover the taskbar, but go behind it.

It works fine when switching to fullscreen at runtime, but it doesn't work when starting the app at system startup.

UPDATE

It turns out that those two lines work very well. They are in the FormShow event handler. If I break point until the end of FormShow, the application seems to be in fullscreen; I can see the application trough the taskbar. But after FormShow the application's Top property gets changed somehow. I don't change it in code - the value is -20, so the application is not maximized anymore.

Is there a way to track where or when it is changed?

Thanks in advance!

UPDATE

This post is flagged. Please do not post any answers! Thank you.

like image 300
Peacelyk Avatar asked Feb 09 '11 06:02

Peacelyk


People also ask

How do I stop Windows from going behind the taskbar?

Try to uncheck the AutoHide and check the lock the toolbar from the taskbar properties. change the Display resolution to highest resolution. change the performance to Best Performance.

Why isn't my taskbar going away when I fullscreen?

Press your Windows key + I together to open your settings. Next, click Personalization and select Taskbar. on the left pane, click Task Bar choose the options “Automatically hide the taskbar in desktop mode” and “automatically hide the taskbar in tablet mode”. Make sure they're turned on.

Why does my toolbar keep hiding?

One of the first things you should check if your Windows taskbar keeps disappearing is your taskbar properties. When "Auto-hide" is selected in the taskbar properties, your taskbar is only revealed when you mouse-over the area where it's supposed to be located. Uncheck "Auto-hide" to stop it from disappearing.


1 Answers

Change the param style, according to this MSDN blog: http://blogs.msdn.com/b/oldnewthing/archive/2005/05/05/414910.aspx

procedure TForm1.CreateParams(var Params: TCreateParams); 
begin
  inherited; 
  Params.Style := WS_POPUP or WS_VISIBLE; //will overlay taskbar
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Self.WindowState := wsMaximized; //fullscreen
end;

====================================

Full code to switch from Windowed to fullscreen mode and back (tested on Win7 64bit, Aero)
(Edit: works in Windows XP (vmware) too)

var
  _OrgWindowedStyle: DWORD;

procedure TForm6.btnWindowedClick(Sender: TObject);
begin
  Self.WindowState := wsNormal;
  //set original style
  SetWindowLong( Application.Handle, GWL_STYLE,
                 _OrgWindowedStyle);
  //re-create window, to use changed style
  RecreateWnd;
end; 

procedure TForm6.btnFullScreenClick(Sender: TObject);
begin
  _OrgWindowedStyle := 0;  //clear: re-applies fullscreen mode in CreateParams
  Self.WindowState  := wsMaximized;
  //re-create window, to use changed style
  RecreateWnd;
end;

procedure TForm6.CreateParams(var Params: TCreateParams);
begin
  inherited;

  //first time? default fullscreen
  if _OrgWindowedStyle = 0 then
  begin
    _OrgWindowedStyle := Params.Style;
    Params.Style := //WS_POPUP or               //not needed?
                    WS_VISIBLE
                    or WS_BORDER or WS_CAPTION  //comment this line to remove border + titlebar
  end;
end;

procedure TForm6.FormCreate(Sender: TObject);
begin
  Self.WindowState := wsMaximized;     //default fullscreen
end;
like image 148
André Avatar answered Oct 13 '22 12:10

André