Delphi -Hide/Show Start button.

Delphi -Hide/Show Start button.

Postby Dieliric » 14 Feb 2011, 20:35

Daca tot am inlocuit imaginea butonului "start" acum m-am gandit sa il si ascund putin, more fun than useful ;)). The code:
  1. (*        HIDE START BUTTON         *)
  2. (*             Dieliric             *)
  3.  
  4. unit Unit1;
  5.  
  6. interface
  7.  
  8. uses
  9.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  10.   StdCtrls;
  11.  
  12. type
  13.   TForm1 = class(TForm)
  14.     Button1: TButton;
  15.     Button2: TButton;
  16.     procedure Button1Click(Sender: TObject);
  17.     procedure Button2Click(Sender: TObject);
  18.   private
  19.     { Private declarations }
  20.   public
  21.     { Public declarations }
  22.     procedure HideStartButton(AVisible: Boolean);
  23.   end;
  24.  
  25. var
  26.   Form1: TForm1;
  27.  
  28. implementation
  29.  
  30. {$R *.DFM}
  31.  
  32. procedure TForm1.Button1Click(Sender: TObject);
  33. var
  34.   buttonSelected : Integer;
  35. begin
  36.   buttonSelected := MessageDlg('Vrei sa il fac invizibil?',mtInformation, mbOKCancel, 0);
  37.   if buttonSelected = mrOk then HideStartButton(False);
  38. end;
  39.  
  40. procedure TForm1.Button2Click(Sender: TObject);  
  41. var
  42.   buttonSelected : Integer;
  43.  begin
  44.   HideStartButton(True);
  45.   buttonSelected := MessageDlg('Hai ca l-am facut vizibil',mtInformation, mbOKCancel, 0);
  46.   if buttonSelected = mrCancel then HideStartButton(False);
  47. end;
  48.  
  49. procedure TForm1.HideStartButton(AVisible: Boolean);
  50. var
  51.   Tray, Child, StartButtonHandle: HWnd;
  52.   C: array[0..127] of Char;
  53.   S: string;
  54. begin
  55.   Tray:=FindWindow('Shell_TrayWnd', nil);
  56.   Child:=GetWindow(Tray, GW_CHILD);
  57.   while Child<>0 do
  58.   begin
  59.     if GetClassName(Child, C, SizeOf(C))>0 then
  60.     begin
  61.       S:=StrPas(C);
  62.       if UpperCase(S)='BUTTON' then
  63.       begin                           (* verificam daca este vizibila fereastra  si facem si nebuniile *)
  64.         StartButtonHandle:=Child;
  65.         if AVisible then ShowWindow(Child, 1)
  66.         else ShowWindow(Child, 0);
  67.       end;
  68.     end;
  69.     Child:=GetWindow(Child, GW_HWNDNEXT);
  70.   end;
  71. end;
  72.  
  73. end.

Hide ... Show start.rar - 332.5 Kb. Versiunea a doua e pentru more fun ;)).
1.5p / 2 votes
"Nu spun ca nu stiu ci nu stiu inca"
User avatar
Dieliric
Bit
 
Joined: 08 Jan 2010
Location: Roman
Status: 7

Re: Delphi -Hide/Show Start button.

Postby smith » 15 Feb 2011, 00:41

Am dezarhivat și am testat exe-urile. La mine cel puțin nu se întâmplă nimic.
LE: Iertare. Nu am citit ce face programul :))
Pe Windows7 64bit nu face nimic...
0,0p / 0 votes
Ilea Cristian
User avatar
smith
Enum
 
Joined: 29 Dec 2009
Location: Cluj-Napoca
Status: 82

Re: Delphi -Hide/Show Start button.

Postby DarkByte » 15 Feb 2011, 00:42

Nu e niciun trick, smith. Pe Vista si Seven e ceva in plus - nu stiu exact ce, nu am fost prea interesat - ascunzi butonul care exista din Win '95 incoace, dar iti mai ramane ceva pe care poti da click :))

MS stuff :-j
0,0p / 0 votes
User avatar
DarkByte
11011011
 
Joined: 29 Dec 2009
Status: 140

Re: Delphi -Hide/Show Start button.

Postby Dieliric » 15 Feb 2011, 13:45

Da, am uitat sa precizez faptul ca doar pana la XP se poate ascunde butonul folosind programul asta, nu am windows 7 ca sa vad ce ar fi in plus :-?.
0,0p / 0 votes
"Nu spun ca nu stiu ci nu stiu inca"
User avatar
Dieliric
Bit
 
Joined: 08 Jan 2010
Location: Roman
Status: 7


Return to Snippets

Who is online

Users browsing this forum: No registered users and 0 guests

cron