The application remains behind the taskbar when launched in full screen mode

This is the code I'm using:

BorderStyle := bsNone; WindowState := wsMaximized; 

My problem is that the application will not close the taskbar, but behind.

It works great when switching to full-screen mode at run time, but it does not work when the application starts at system startup.

UPDATE

It turns out that these two lines work very well. They are in the FormShow event handler. If I break the dot to the end of FormShow, the application seems to be in full screen mode; I see the application through the taskbar. But after FormShow, the property of the Top application becomes somehow changed. I do not change it in the code - the value is -20, so the application is no longer maximized.

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

Thanks in advance!

UPDATE

This post is flagged. Please do not post any answers! Thanks.

+6
delphi
source share
2 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 for switching from window to full screen mode and vice versa (tested on Win7 64bit, Aero)
(Edit: works on 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; 
+2
source share

to try:

 Form.Left := 0; // set the x Form.Top := 0; // set the y Form.Width := Screen.Width; // width of the form Form.Height := Screen.Height; // height of the form // and Form.FormStyle := fsStayOnTop; // taskbar is always on top as well, setting the Style property to always on top will allow the form to cover the taskbar 

if you want to hide the title, set borderstyle to bsnone

+1
source share

All Articles