Mega Code Archive

 
Categories / Delphi / API
 

Disabling the win95 start button

Question: How do I hide and disable the Win95 start button? Answer: The following example both hides and unhides the Windows start button, and also enables and disables the start button. Example: procedure TForm1.Button1Click(Sender: TObject); var Rgn : hRgn; begin {Hide the start button} Rgn := CreateRectRgn(0, 0, 0, 0); SetWindowRgn(FindWindowEx(FindWindow('Shell_TrayWnd', nil), 0, 'Button', nil), Rgn, true); end; procedure TForm1.Button2Click(Sender: TObject); begin {Turn the start button back on} SetWindowRgn(FindWindowEx(FindWindow('Shell_TrayWnd', nil), 0, 'Button', nil), 0, true); end; procedure TForm1.Button3Click(Sender: TObject); begin {Disable the start button} EnableWindow(FindWindowEx(FindWindow('Shell_TrayWnd', nil), 0, 'Button', nil), false); end; procedure TForm1.Button4Click(Sender: TObject); begin {Enable the start button} EnableWindow(FindWindowEx(FindWindow('Shell_TrayWnd', nil), 0, 'Button', nil), true); end