svět, kde se rodí nová budoucnost   
 
Delphi headDelphi Tips

Making Start Button Invisible or Disable


How to make Start Button Invisible?
The following code is written in Delphi 5.0 and uses Win32 API only.  This code can hide, unhide, enable and disables the Win9x Start Button.

Create a new Application by choosing File > New > Application. Place 4 Buttons on the MainForm. Add following code to event handlers of each button.


{ Button 1 Hides the Start Button}
procedure TForm1.Button1Click(Sender: TObject);
var
  Rgn : hRgn;
begin
  Rgn := CreateRectRgn(0, 0, 0, 0);
  SetWindowRgn(FindWindowEx(FindWindow(
'Shell_TrayWnd',     nil), 0, 'Button', nil), Rgn, true);
end;


{ Button 2 UnHides the Start Button}
procedure TForm1.Button2Click(Sender: TObject);
begin
  SetWindowRgn(FindWindowEx(FindWindow('Shell_TrayWnd',     nil), 0, 'Button', nil), 0, true);
end;

{ Button 3 Disables the Start Button}
procedure TForm1.Button3Click(Sender: TObject);
begin
  EnableWindow(FindWindowEx(FindWindow('Shell_TrayWnd',     nil), 0, 'Button', nil), false);
end;

{ Button 4 Enables the Start Button}
procedure TForm1.Button4Click(Sender: TObject);
begin
  EnableWindow(FindWindowEx(FindWindow('Shell_TrayWnd',     nil), 0, 'Button', nil), true);
end;

Back to Index of Tips

 

 

Send mail to radek.novak@infojet.cz with questions or comments about this web site.
Copyright © 1999-2002 Infojet.cz
Last modified: 26.07.2002