Autor Beitrag
firefuzy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 69

Win 98 SE, WinXP Prof, Vista HPrem.
Delphi 7
BeitragVerfasst: Mi 04.06.08 14:38 
Hallo!

Ich schreibe gerade ein Programm, dessen Unterfenster alle einen Taskleisten-Eintrag erhalten sollen. Leider weiß ich allerdings nicht so recht wie man das realisieren muss. Ich war zunächst ziemlich erstaunt, dass man mit Google zu diesem Thema nicht sehr viel findet, obwohl ja eigentlich jedes Programm für seine Unterfenster einen Taskbareintrag anlegt (z.B. Firefox: Downloads, Add-Ons, Lesezeichen-Manager, etc. haben alle eigene Einträge). Vielleicht sehe ich aber auch den Wald vor lauter Bäumen nicht.

Um einen Taskbar hinzuzufügen habe ich das hier gefunden. Allerdings reagiert die Form dann nicht mehr auf Form.Close oder Form.Visible := false;
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm.CreateParams(Var params: TCreateParams);
begin
  inherited CreateParams( params );
  params.ExStyle := params.ExStyle or WS_EX_APPWINDOW;
  params.WndParent := GetDesktopwindow;
end;

Ich habe außerdem nichts gefunden, wie man den Eintrag beim schließen des Fensters wieder entfernt. Außerdem beendet sich die Anwendung durch obigen Code auch nicht mehr, wenn das Hauptfenster geschlossen wird.

Ich hoffe Ihr könnt mir weiterhelfen, sodass jedes Fenster einen Taskleisteneintrag bekommt, der wieder verschwindet, wenn man das Fenster schließt.

MfG firefuzy
nagel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 708

Win7, Ubuntu 10.10

BeitragVerfasst: Mi 04.06.08 17:20 
Vielleicht hilft das hier.
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Mi 04.06.08 18:31 
Lass die Zeile mit GetDesktopWindow weg, das sollte reichen...

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
firefuzy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 69

Win 98 SE, WinXP Prof, Vista HPrem.
Delphi 7
BeitragVerfasst: Mo 09.06.08 21:26 
Zitat:
Lass die Zeile mit GetDesktopWindow weg, das sollte reichen...

Das hat keinen sichtbaren Unterschied gebracht.

ausblenden Delphi-Quelltext
1:
SetWindowLong(Handle, GWL_EXSTYLE, WS_EX_APPWINDOW);					

erstellt zwar einen Taskbareintrag, aber er verschwindet wieder sobald die Form minimiert wird, vielleicht weil die Mainform unsichtbar ist?

Außerdem hat die Mainform einen Taskbareintrag, auch wenn sie unsichtbar ist. Wie kann ich diesen entfernen?
firefuzy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 69

Win 98 SE, WinXP Prof, Vista HPrem.
Delphi 7
BeitragVerfasst: Di 10.06.08 22:26 
Sorry für den Doppelpost, aber ich kann einfach nicht vertehen, dass das so kompliziert ist.
Bei Visual Basic gibts einfach eine Property "ShowInTaskbar" die setzt man auf True und dann hat sich's! :roll:
Keine Verrenkungen mit extra Codezeilen um hinzubekommen, was doch eigentlich Standard sein dürfte.

Muss ich nur deshalb zu Visual Basic wechseln?

EDIT:

Weiß den wirklich niemand mehr weiter???
firefuzy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 69

Win 98 SE, WinXP Prof, Vista HPrem.
Delphi 7
BeitragVerfasst: So 22.06.08 14:58 
Halleluja ich habe endlich das gefunden was ich gesucht habe; danke Google Groups :flehan:

Für alle die auch versuchen, für jede Form einen Taskbareintrag/-button zu erzeugen hier der Link:
groups.google.com/gr...msg/85242b2f0e4b8a12


Kurz zusammengefasst muss man in der Mainform folgende Prozeduren einfügen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
Procedure TForm1.WMSyscommand(Var msg: TWmSysCommand); message WM_SYSCOMMAND;
[...]
Procedure TForm1.WMSyscommand(Var msg: TWmSysCommand);   
  Begin 
    Case (msg.cmdtype and $FFF0) of 
      SC_MINIMIZE: Begin 
          ShowWindow( handle, SW_MINIMIZE ); 
          msg.result := 0; 
        End;   
      SC_RESTORE: Begin 
          ShowWindow( handle, SW_RESTORE ); 
          msg.result := 0; 
        End;   
      Else 
        inherited; 
    End; 
  End; 

Procedure TForm1.FormCreate(Sender: TObject);
begin
  ShowWindow( Application.handle, SW_HIDE ); 
  SetWindowLong( Application.handle, 
                 GWL_EXSTYLE, 
                 GetWindowLong( application.handle, GWL_EXSTYLE ) and 
                   not WS_EX_APPWINDOW or WS_EX_TOOLWINDOW); 
  ShowWindow( Application.handle, SW_SHOW );
end;


und folgende in jeder Form mit Taskbareintrag:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
Procedure CreateParams( Var params: TCreateParams ); override;
[...]
Procedure TForm<Nummer der Form>.CreateParams( Var params: TCreateParams ); 
begin 
  inherited CreateParams( params ); 
  params.ExStyle := params.ExStyle  or WS_EX_APPWINDOW; 
end;


MfG
firefuzy