Hiding windows start menu bar

Hi everybody, hope you doing all right today : )

I'm trying to write an application that covers the entire screen.

I started with the start menu thing and found this code which goes back in time to D5.

procedure ShowStartButton(bvisible: Boolean);
var
  h: hwnd;
  TaskWindow: hwnd;
begin
  if bvisible then
  begin
    h := FindWindowEx(GetDesktopWindow, 0, 'Button', nil);
    TaskWindow := FindWindow('Shell_TrayWnd', nil);
    ShowWindow(h, 1);
    Windows.SetParent(h, TaskWindow);
  end 
  else
  begin
    h := FindWindowEx(FindWindow('Shell_TrayWnd', nil), 0, 'Button', nil);
    ShowWindow(h, 0);
    Windows.SetParent(h, 0);
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowStartButton(False); // or true to reshow
end;

Open in new window


Due to my shallow knowledge about Windows API, I couldn't figure out the issue that popped up after pasting the code which was:

Undeclared identifier: Windows
Undeclared identifier: SetParent

Even though the units Windows, ShellApi are declared in the uses block.

I'm using XE2 by the way and I believe that things were moved around a bit when it comes to units and declarations in comparison to older versions.

Any solution or alternatives?

Appreciated in advance.
LVL 1
gxsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gxsAuthor Commented:
Found it and works perfectly on Windows 7

// To Show
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowWindow(findwindow('Shell_TrayWnd',nil), SW_Show);
ShowWindow(FindWindow('Button', 'Start'), SW_Show);
end;

// To Hide
procedure TForm1.Button2Click(Sender: TObject);
begin
ShowWindow(findwindow('Shell_TrayWnd',nil), SW_HIDE);
ShowWindow(FindWindow('Button', 'Start'), SW_HIDE);
end;

Open in new window


Cheers.
0
gxsAuthor Commented:
And this to cover the entire screen even the taskbar:

procedure TForm1.FormShow(Sender: TObject);
begin
SetWindowPos(Handle, HWND_TOPMOST, 0, 0, Screen.Width, Screen.Height, 0);
end;

Open in new window

0
Sinisa VukSoftware architectCommented:
If you find solution by yourself, why didn't close question?
As you found it - there is no need to hide taskbar to resize form to full screen.
0
MerijnBSr. Software EngineerCommented:
In addition, the following function will also hide the Windows Vista / 7 / 8 start orb.

procedure TMainForm.HideTaskBar(Hide: boolean);
var cmd: integer;
begin
 if Hide then
  cmd := SW_HIDE
 else
  cmd := SW_SHOWNA;

 ShowWindow(FindWindow('Shell_TrayWnd', nil), cmd);

 // In case we're running Vista or Win7, hide the start orb as well
 ShowWindow(FindWindowEx(0, 0, MakeIntAtom($C017), nil), cmd);
end;

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.