Autor Beitrag
rmasterb
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 71



BeitragVerfasst: Do 10.04.03 15:51 
kann mir einer sagen ob es möglch ist ein bodericon zu erstellen welches eine von mir bestimmte funktion hat und wenn wie mache ich das??

(zB wie bei e-mule die ein bordericon zu "programm in tray" haben)

merci RMasterB
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Do 10.04.03 18:01 
Du musst auf die WM_NCPAINT Message reagieren. Dann kannst du dir mit GetWindowDC ein DC-Handle für das gesamte Fenster holn und deinen Button in die Titelleiste pinseln...

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



BeitragVerfasst: Fr 11.04.03 06:28 
Titel: danke
danke für den tip aber ich weiß nicht einmal wie ich mit einem handle umgehe bin halt noch anfänger.
kannst du er bitte genauer schreiben (pinseln bekomme ich hin)
danke
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 11.04.03 07:19 
Ich weiß nicht, ob das die beste Lösung ist, aber es ist eine:
home.pages.at/dbr-so...e/delphi/button4.htm
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Fr 11.04.03 13:56 
oder such mal hier im forum !! wir hatten schon recht viele themen darüber, und ein paar gute kompos und lösungen !

_________________
In the beginning was the word.
And the word was content-type: text/plain.
rmasterb Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 71



BeitragVerfasst: Fr 11.04.03 18:43 
also im forum habe ich schonmal unterbordericon gesuch aber nix gefunden (warum auch immer). und zu luckie: der versucht in dem quellcode einer konstante einen wert zuzuweisen :nixweiss: ich glaube nicht dass das irgendwie geht (delphi zeigt zumindestens en fehler an)

nett das ihr es versucht habt. schreibt mal bitte wenn ihr ne idee für mich habt
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 11.04.03 18:51 
Versuch mal "Button" und /oder "Titelleiste".

Ich hatte den Code sleber mal ausprobiert und er ging, allerdings weis ich nicht, ob ich da noch was geändert haeb.
rmasterb Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 71



BeitragVerfasst: Fr 11.04.03 20:12 
wie ich mitbekommen habe steht hier keiner auf vorkauen. is auch nicht schlimm aber ich hab echt kein plan wie ich anfangen soll einige befehle würden mir vieleicht weiterhelfen.
danke nochmal für die Suchbegriffvorschläge aber da finde ich nicht wirklich was.

merci
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 11.04.03 20:20 
Versuch mal das:
ausblenden volle Höhe 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:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormPaint(Sender: TObject);
    procedure FormResize(Sender: TObject);
  private
    { Private-Deklarationen }
    procedure WMACTIVATE(var Msg: TMessage); Message WM_ACTIVATE;
    procedure WMNCHITTEST(var Msg: TWMNChittest); Message WM_NCHITTEST;
    procedure WMNCLBUTTONDOWN(var Msg: TMessage); Message WM_NCLBUTTONDOWN;
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

var
  bHit: Boolean;

procedure TForm1.WMNCHITTEST(var Msg: TWMNChittest);
var
  x,y: SmallInt;
  dc: HDC;
  rect: TRect;
begin
  DefaultHandler(Msg);
  x := Msg.XPos-Left;
  y := Msg.YPos-Top;
  GetWindowRect(Handle, rect);
  if (x <= width) and (x >= width-21)
    and (y >= 0) and
    (y <= GetSystemmetrics(SM_CYEDGE)+14) then
  begin
    bHit := TRUE;
  end
  else
    bHit := FALSE;
end;

procedure TForm1.WMNCLBUTTONDOWN(var Msg: TMessage);
begin
  if bHit = TRUE then Close
  else
    inherited;
end;

procedure TForm1.WMACTIVATE(var Msg: TMessage);
var
  rgn: HRGN;
  rect, btnrect: TRect;
  dc: HDC;
  szBuffer: array[0..255] of Char;
  bmp: TBITMAP;
  brush : HBRUSH;
begin
  if Msg.Msg = WM_ACTIVATE then
  begin
    dc := GetWindowDC(Handle);
    rect.Left := GetSystemmetrics(SM_CXEDGE);
    rect.Top := GetSystemmetrics(SM_CYEDGE);
    rect.Right := Form1.Width-GetSystemmetrics(SM_CYEDGE);
    rect.Bottom := Getsystemmetrics(SM_CYCAPTION)+GetSystemmetrics(SM_CYFRAME);
    try
      bmp := TBITMAP.Create;
      bmp.loadfromfile('.\MyButton.bmp');
      btnrect.Left := Width-21;
      btnrect.Top := rect.Top+1;
      brush := CreateSolidBrush(RGB(255,0,0));
      SelectObject(dc, brush);
      Rectangle(dc, rect.Left, rect.Top, rect.Right, rect.Bottom);
      StretchBlt(dc, btnrect.Left, btnrect.Top+2, bmp.Width, bmp.Height,
        bmp.Canvas.Handle, 0, 0, bmp.Width, bmp.Height, SRCCOPY);
      lstrcpy(szBuffer, 'Meine Fenstercaption');
      SetBkMode(dc, TRANSPARENT);
      SetTextColor(dc, RGB(255,255,255));
      DrawText(dc, szBuffer, lstrlen(szBuffer), rect, DT_CENTER or DT_VCENTER);
    finally
      bmp.Free;
    end;
      ReleaseDC(Handle, dc);
  end
  else
    Inherited;
  ReleaseDc(Handle, dc);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  PostMessage(Handle, WM_ACTIVATE, 0, 0);
end;

procedure TForm1.FormPaint(Sender: TObject);
begin
  SendMessage(handle, WM_ACTIVATE, 0 , 0);
end;

procedure TForm1.FormResize(Sender: TObject);
begin
  SendMessage(handle, WM_ACTIVATE, 0 , 0);
end;
rmasterb Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 71



BeitragVerfasst: Sa 12.04.03 11:56 
Titel: Danke
Supernet von dir mir das zu schreiben!!!!
Es gibt da aber noch ein kleines problem: Ich verstehe nicht das geringste von dem was du da hingezaubert hast.
da ich eigentlich den button auch ansprechenwollte, währe es sehr nett von dir mir wenigstens ansatzweise zu erläutern was zB messages sind etc.

Danke im Voraus :wink:
rmasterb Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 71



BeitragVerfasst: Sa 12.04.03 12:26 
ich denke ich habe so einigermaßen durchgesehen, aber um den button zu benutzen muß ich herausbekommen wann sich der cursor auf dem button befindet.leider gibt es bei der onmousemove procedure blos das X und Y, doch die beziehen sich nur auf die form und gehen nicht über sie hinaus :cry:

also muß ich die koordinaten der maus herausbekommen und dazu brauche ich eure hilfe
rmasterb Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 71



BeitragVerfasst: Sa 12.04.03 12:52 
ich hab jetzt mal folgendes probiert, was aber leider nicht gefunz hat:
ausblenden volle Höhe 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:
procedure TForm1.FormCreate(Sender: TObject);
begin
  PostMessage(Handle, WM_ACTIVATE, 0, 0);
  tmouse.Create;
  {m:tmouse}
  m.capture := GetWindowDC(Handle);
end;

procedure TForm1.FormPaint(Sender: TObject);
begin
  SendMessage(handle, WM_ACTIVATE, 0 , 0);
end;

procedure TForm1.FormResize(Sender: TObject);
begin
  SendMessage(handle, WM_ACTIVATE, 0 , 0);
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
 if ((m.CursorPos.X>10)and(m.CursorPos.X<200)and(m.CursorPos.y>1)and (m.CursorPos.y<200))
  then  {die editfelder sind nur zu testzwecken da}
   Edit1.Text:='ok'
  else
   Edit1.Text:='False';
 Edit2.Text:=inttostr(m.cursorpos.X);
 Edit3.Text:=inttostr(m.cursorpos.y);
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
 m.Free;
end;


is das handle falsch?? oder muß ich es einfach nur anders machen??
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 12.04.03 20:04 
Hier:
ausblenden Quelltext
1:
procedure TForm1.WMNCHITTEST(var Msg: TWMNChittest);					

wird gekuckt, ob beim Klick die Maus über dem Button war.
rmasterb Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 71



BeitragVerfasst: So 13.04.03 19:42 
woher will die procedure wissen wann sie über meinem selbstgemalten button ist ??

der selbstgemalte wird doch garnicht von windows (oder so :?: ) gegeben

wie soll ich jetzt damit hanteren (ich weiß immer noch nicht wie man eine message benutzt geschweige denn was das ist)

danke ich werd gucken was sich mit der procedure anfangen lässt