Link to home
Start Free TrialLog in
Avatar of aztec
aztec

asked on

Re-opening of question "Enlarging app to full-screen" from before

Sorry, but I see now that this answer by Viktornet does not work. I have just bought a new computer and I tried my app on it and it does not show the full screen. Can we re-open this question?

Thanks
   Shawn

P.S: The computer I developed my app on has screen resolution of 800 X 600. My new one I just tried it on is 1024 X 768. I would like my app to be robust enough to adapt to all different screen sizes/resolutions and be always 'full-screen'.
Avatar of freshman3k
freshman3k

Hello!

Just put the following code in onShow event of your form:

{Set form size to full screen}
Form1.Left:=0;
Form1.Top:=0;
Form1.Height:= Screen.Height;
Form1.Width:= Screen.Width;

{make your window top-most,so it would be ontop of the taskbar and all other windows}
SetWindowPos(Form1.Handle, HWND_TOPMOST, 0,0,0,0,SWP_NOACTIVATE+SWP_NOMOVE+SWP_NOSIZE);

Hope this helps! ;-)

Go to: http://www.delphi3000.com/article.asp?ID=1266 for
'Make your app to fill entire screen excluding taskbar' article .

To show over taskbar just change the SetBounds values with:

SetBounds(0,0, Screen.Width, Screen.Height);

Avatar of aztec

ASKER

Freshman3k - your suggestion does indeed make my form cover the whole screen, but the rightmost and bottommost part of my form is now blank and it looks crappy.

I guess what I mean to say is how to make my form - AND all its components - cover the full screen. I developed my app in a 800 X 600 resolution environment and my form covers the whole screen there (excluding taskbar) and it looks good; but when you run it on a 1024 X 768 environment, the right and bottom parts of my form are empty... all the components are still bunched over to the top and left. Do you see what I mean?
hello!

oh ,I see what you mean
Avatar of aztec

ASKER

ok, so any idea how I can do it?
ASKER CERTIFIED SOLUTION
Avatar of freshman3k
freshman3k

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Have you try my way ?
Avatar of aztec

ASKER

Hi Freshman3k, your form resizing suggestion, together with the 'easysize' resizing component works well, but my form now covers the taskbar. How do I get it to not do this? Does it have something to do with this statement:

SetWindowPos(Form1.Handle, HWND_TOPMOST, 0,0,0,0,SWP_NOACTIVATE+SWP_NOMOVE+SWP_NOSIZE);

Thanks
   Shawn
Just a side note, the SWP_NOACTIVATE, SWP_NOMOVE, SWP_NOSIZE are intended to be used with an OR inbetween not a plus sign..

Like so...
SetWindowPos(Form1.Handle, HWND_TOPMOST, 0,0,0,0,SWP_NOACTIVATE OR SWP_NOMOVE OR SWP_NOSIZE);

And you should not use the entire screen if you do not want to obscure the taskbar.

Procedure SetSize;
Var
 R : TRect;
 I : LongBool;
begin
  I := SystemParametersInfo(SPI_GETWORKAREA, 0, @R, 0);
  If I Then Begin
    Top := R.Top;
    Height := R.Bottom - R.Top;
    Left := R.Left;
    Width := R.Right - R.Left;
  End;
End;

Regards
//raidos
Ohh...i may have misunderstood your objective...

if you want your form to be below the taskbar change

HWND_TOPMOST to HWND_NOTOPMOST

Regards
//raidos
aztec ,

I think that you ignore me so I will leave this topic .

If you give couple minutes to my comments you can see that is the answer for your problem.

Read the title : 'Make your app to fill entire screen excluding taskbar'

This function calculate the all work area ( for any resolution ). The result is a FULL SCREEN FORM THAT DON'T COVER THE TASKBAR FOR ANY SCREEN RESOLUTION.

Wish you luck,
Nick

P.S. Tested already on my system .
Avatar of aztec

ASKER

ginsonic - I am not a 'member' of that group you mention. I cannot see your suggested answer! Can you list it for me?

Shawn
Whay don't register? Is a very good site and you can register for free and can read 50 articles from database and the all articles posted in that day . So if you visit daily the site can read all articles posted after your registration.
This is the code used by me :

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    procedure WMSettingChange( var Msg: TMessage); message WM_SETTINGCHANGE;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

function Area: TRect;
begin
 SystemParametersInfo(SPI_GETWORKAREA, 0, @Result, 0);
end;

procedure TForm1.WMSettingChange( var Msg: TMessage);
var R: TRect;
begin
 if (Msg.WParam=SPI_SETWORKAREA) then begin
   R:=Area;
   SetBounds(R.Left, R.Top, R.Right-R.Left, R.Bottom-R.Top);
   end;
 Msg.Result:=0;
end;

procedure TForm1.FormCreate(Sender: TObject);
var R: TRect;
begin
 R:=Area;
 SetBounds(R.Left, R.Top, R.Right-R.Left, R.Bottom-R.Top);
end;

end.
 
Avatar of aztec

ASKER

ginsonic - I get a compile error "File not found: "Variants.dcu". I'm using D3 Professional.

Shawn
Avatar of aztec

ASKER

Raidos - I don't understand your answer. What do I do with this procedure SetSize? Can you give me more details?
Avatar of aztec

ASKER

freshman3k are you there? Your suggestion covers my whole screen including the taskbar. i do not want to cover the taskbar.
Avatar of aztec

ASKER

So far I have received several suggestions, but no one has offered a complete solution that fully works.

Shawn
Remove Variants. I use D6 .
You don't need to add any unit , just the procedures .