Thema: Delphi How to hide Startmenu

Einzelnen Beitrag anzeigen

Benutzerbild von turboPASCAL
turboPASCAL

Registriert seit: 8. Mai 2005
Ort: Sondershausen
4.274 Beiträge
 
Delphi 6 Personal
 
#16

Re: How to hide Startmenu

  Alt 20. Okt 2008, 04:16
???

Delphi-Quellcode:
function ShowOrHideStartWndBtn(Action: Boolean): Boolean; // save Version
var
  hShellTrayWnd, hStartBtn: HWND;
begin
  Result := FALSE;
  hStartBtn := 0;

  // find the ShellTrayWindow
  hShellTrayWnd := FindWindow('Shell_TrayWnd', nil);

  // find the Start Button
  if hShellTrayWnd <> 0 then
  begin
    hStartBtn := FindWindowEx(hShellTrayWnd, 0, 'Button', nil);

    if hStartBtn <> 0 then
    begin
      Result := TRUE;
      case Action of
         TRUE: ShowWindow(hStartBtn, SW_SHOW); // now show the Button
        FALSE: ShowWindow(hStartBtn, SW_HIDE); // where is the button now?
      end;
    end;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowOrHideStartWndBtn(TRUE); // Show the Start Button
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  ShowOrHideStartWndBtn(FALSE); // Hide the Start Button
end;
warning bad English

Zitat von Razor:
Ok i made something, please comment it and why it won't work as it should..
Delphi-Quellcode:
// ...

var // var -> def global Variable
  Form2: TForm2; // def. Form2 as any Type of TForm2
  handle1,taskBarWnd: hwnd; // def. handle1 and taskBarWnd as any Windowhandle

implementation // the section of a unit begins

uses Unit3; // include Unit3.pas

{$R *.dfm}                    // include all Resources with "dfm"-extensions

procedure tform2.hide; // define porocedure "hide" from "form2"
begin // instruction begins
  taskBarWnd := FindWindow('Shell_TrayWnd', 0); // find the window "Shell_TrayWnd"
  handle1:=FindWindowEx(taskBarWnd, 0, 'Button', 'Start'); // find in Window "Shell_TrayWnd" the Window "Button"
  closewindow(handle1); // minimizes, but does not destroy the specified window.
end; // instruction ends for porocedure "hide"
you cannot close the button !
Matti
Meine Software-Projekte - Homepage - Grüße vom Rüsselmops -Mops Mopser
  Mit Zitat antworten Zitat