Autor Beitrag
stigge
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Sa 24.03.07 20:00 
Ist es möglich, mein Programm über der Taskleiste anzudocken?
Also über der Taskleiste am linken Desktoprand?


Moderiert von user profile iconGausi: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am So 25.03.2007 um 14:24
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: Sa 24.03.07 21:37 
Kann man das eventuell irgendwie ausrechnen?
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Sa 24.03.07 21:45 
Wie wärs mal mit der Suche. :wink:
www.delphi-forum.de/...ht=taskleiste+h%F6he
Dann kannst Du Dir das ausrechnen

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
hathor
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 24.03.07 22:41 
ausblenden volle Höhe 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:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
private
    { Private declarations }
    procedure WMWINDOWPOSCHANGING (Var Msg: TWMWINDOWPOSCHANGING); message WM_WINDOWPOSCHANGING;


procedure TForm1.WMWINDOWPOSCHANGING (var Msg: TWMWINDOWPOSCHANGING);
const
  Docked: Boolean = FALSE;
var
  rWorkArea: TRect;
  StickAt : Word;

begin

  SystemParametersInfo (SPI_GETWORKAREA, 0, @rWorkArea, 0);

  with Msg.WindowPos^ do 
  begin

    if x <= rWorkArea.Left + StickAt then 
     begin
      x := rWorkArea.Left;
      Docked := TRUE;
     end;

    if y + cy >= rWorkArea.Bottom - StickAt then 
     begin
      y := rWorkArea.Bottom - cy;
      Docked := TRUE;
     end;

    if Docked then begin
      with rWorkArea do begin
      // no moving out of the screen
      if x < Left then x := Left;
      if x + cx > Right then x := Right - cx;
      if y < Top then y := Top;
      if y + cy > Bottom then y := Bottom - cy;
      end; {with rWorkArea}
    end; {if Docked}
  end; {with  Msg.WindowPos^}

  inherited;
end;
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 24.03.07 23:07 
Einfacher:
ausblenden Delphi-Quelltext
1:
Form1.ScreenSnap := True;					

Vielleicht reicht das dir ja schon.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: So 25.03.07 11:01 
user profile iconGTA-Place hat folgendes geschrieben:
Einfacher:
ausblenden Delphi-Quelltext
1:
Form1.ScreenSnap := True;					

Vielleicht reicht das dir ja schon.

Und was macht das?


user profile iconhathor hat folgendes geschrieben:
ausblenden volle Höhe 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:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
private
    { Private declarations }
    procedure WMWINDOWPOSCHANGING (Var Msg: TWMWINDOWPOSCHANGING); message WM_WINDOWPOSCHANGING;


procedure TForm1.WMWINDOWPOSCHANGING (var Msg: TWMWINDOWPOSCHANGING);
const
  Docked: Boolean = FALSE;
var
  rWorkArea: TRect;
  StickAt : Word;

begin

  SystemParametersInfo (SPI_GETWORKAREA, 0, @rWorkArea, 0);

  with Msg.WindowPos^ do 
  begin

    if x <= rWorkArea.Left + StickAt then 
     begin
      x := rWorkArea.Left;
      Docked := TRUE;
     end;

    if y + cy >= rWorkArea.Bottom - StickAt then 
     begin
      y := rWorkArea.Bottom - cy;
      Docked := TRUE;
     end;

    if Docked then begin
      with rWorkArea do begin
      // no moving out of the screen
      if x < Left then x := Left;
      if x + cx > Right then x := Right - cx;
      if y < Top then y := Top;
      if y + cy > Bottom then y := Bottom - cy;
      end; {with rWorkArea}
    end; {if Docked}
  end; {with  Msg.WindowPos^}

  inherited;
end;

Hört sich gut an. Ich probier's nachher.
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: So 25.03.07 11:51 
user profile iconstigge hat folgendes geschrieben:
Und was macht das?

Auf Entsprechendenen Eintrag im OI klicken und F1

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: So 25.03.07 12:05 
user profile iconhathor hat folgendes geschrieben:
ausblenden volle Höhe 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:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
private
    { Private declarations }
    procedure WMWINDOWPOSCHANGING (Var Msg: TWMWINDOWPOSCHANGING); message WM_WINDOWPOSCHANGING;


procedure TForm1.WMWINDOWPOSCHANGING (var Msg: TWMWINDOWPOSCHANGING);
const
  Docked: Boolean = FALSE;
var
  rWorkArea: TRect;
  StickAt : Word;

begin

  SystemParametersInfo (SPI_GETWORKAREA, 0, @rWorkArea, 0);

  with Msg.WindowPos^ do 
  begin

    if x <= rWorkArea.Left + StickAt then 
     begin
      x := rWorkArea.Left;
      Docked := TRUE;
     end;

    if y + cy >= rWorkArea.Bottom - StickAt then 
     begin
      y := rWorkArea.Bottom - cy;
      Docked := TRUE;
     end;

    if Docked then begin
      with rWorkArea do begin
      // no moving out of the screen
      if x < Left then x := Left;
      if x + cx > Right then x := Right - cx;
      if y < Top then y := Top;
      if y + cy > Bottom then y := Bottom - cy;
      end; {with rWorkArea}
    end; {if Docked}
  end; {with  Msg.WindowPos^}

  inherited;
end;

OK, funktioniert. Aber wie kriege ich das bei Form1.oncreate rein?
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: So 25.03.07 12:07 
Die procedure einbinden.

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: So 25.03.07 12:18 
user profile iconBlackheart666 hat folgendes geschrieben:
Die procedure einbinden.

Hab ich schon versucht:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.FormCreate(Sender: TObject);
begin
TForm1.WMWINDOWPOSCHANGING;
end;

Und die Fehlermeldung:
[Fehler] Unit1.pas(70): E2035 Nicht genügend wirkliche Parameter

Ich weiß aber nicht welche Parameter ich ihm mitgeben soll :gruebel:
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 25.03.07 12:29 
Dann verswuch mal die Fehlermeldung zu deuten und vergleiche deinen Quellcode mit dem hier gepostetetn.
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: So 25.03.07 12:32 
user profile iconLuckie hat folgendes geschrieben:
Dann verswuch mal die Fehlermeldung zu deuten und vergleiche deinen Quellcode mit dem hier gepostetetn.

Ich weiß schon, hat was hiermit zu tun:
ausblenden Delphi-Quelltext
1:
(var Msg: TWMWINDOWPOSCHANGING);					

Aber ich verstehe nicht was ich ihm da geben soll???
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: So 25.03.07 12:33 
ScreenSnap lässt das Form am Bildschirmrand und Taskleiste "kleben". Eigentlich das was du willst, nur einfacher ;-).

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: So 25.03.07 12:38 
user profile iconGTA-Place hat folgendes geschrieben:
ScreenSnap lässt das Form am Bildschirmrand und Taskleiste "kleben". Eigentlich das was du willst, nur einfacher ;-).

Kann man auch bestimmen, wo es am Rand hängen soll?
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: So 25.03.07 12:42 
user profile iconBlackheart666 hat folgendes geschrieben:
user profile iconstigge hat folgendes geschrieben:
Und was macht das?

Auf Entsprechendenen Eintrag im OI klicken und F1

Da steht es.

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: So 25.03.07 12:45 
user profile iconBlackheart666 hat folgendes geschrieben:
user profile iconBlackheart666 hat folgendes geschrieben:
user profile iconstigge hat folgendes geschrieben:
Und was macht das?

Auf Entsprechendenen Eintrag im OI klicken und F1

Da steht es.

???


user profile iconstigge hat folgendes geschrieben:
user profile iconLuckie hat folgendes geschrieben:
Dann verswuch mal die Fehlermeldung zu deuten und vergleiche deinen Quellcode mit dem hier gepostetetn.

Ich weiß schon, hat was hiermit zu tun:
ausblenden Delphi-Quelltext
1:
(var Msg: TWMWINDOWPOSCHANGING);					

Aber ich verstehe nicht was ich ihm da geben soll???

Kann mir nicht jemand helfen???
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: So 25.03.07 12:47 
Ist das denn so Schwer ScreenSnap anklicken F1 drücken.
Wenn Du Es komplizierter magst
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.DockAn(Left:Integer);
var
  TaskbarHeight:Integer;
begin
  TaskbarHeight:=Screen.Height-Screen.WorkAreaHeight;
  Top:=Screen.Height-Height-TaskbarHeight;
  Left:=Left;
end;

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: So 25.03.07 12:57 
user profile iconBlackheart666 hat folgendes geschrieben:
Ist das denn so Schwer ScreenSnap anklicken F1 drücken.
Wenn Du Es komplizierter magst
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.DockAn(Left:Integer);
var
  TaskbarHeight:Integer;
begin
  TaskbarHeight:=Screen.Height-Screen.WorkAreaHeight;
  Top:=Screen.Height-Height-TaskbarHeight;
  Left:=Left;
end;

Schon klar. Wollte eigentlich wissen, wie das mit der anderen Methode geht, aber ok. Diese klappt ja auch ganz gut...
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: So 25.03.07 13:18 
user profile iconBlackheart666 hat folgendes geschrieben:
Ist das denn so Schwer ScreenSnap anklicken F1 drücken.
Wenn Du Es komplizierter magst
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.DockAn(Left:Integer);
var
  TaskbarHeight:Integer;
begin
  TaskbarHeight:=Screen.Height-Screen.WorkAreaHeight;
  Top:=Screen.Height-Height-TaskbarHeight;
  Left:=Left;
end;

Kann man das auch nach rechtsunten statt linksunten befördern?
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: So 25.03.07 14:44 
user profile iconstigge hat folgendes geschrieben:
user profile iconBlackheart666 hat folgendes geschrieben:
Ist das denn so Schwer ScreenSnap anklicken F1 drücken.
Wenn Du Es komplizierter magst
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.DockAn(Left:Integer);
var
  TaskbarHeight:Integer;
begin
  TaskbarHeight:=Screen.Height-Screen.WorkAreaHeight;
  Top:=Screen.Height-Height-TaskbarHeight;
  Left:=Left;
end;

Kann man das auch nach rechtsunten statt linksunten befördern?

Nicht böse gemeint aber so langsam kommt es Mir vor als ob du hier nur fertigen Code erwartest, Du scheinst nicht mal in der Lage zu sein mal F1 zu drücken.
Du sollest Dir mal selbst Gedanken machen.
Schau dir doch mal den Code an dort siehst Du zb. Screen.Height dann wird es sicherlich auch Screen.Width geben.
Deine Form hat auch eine Weite und schon kannst Du Dir deine Frage selbst beantworten. :wink:

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)