Autor Beitrag
Lui
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 84

Win XP, Win 2000, Linux
D7
BeitragVerfasst: Di 12.11.02 20:18 
Hi,

habe ein Icon minimizedToTNA. Nun meine Frage:
Wie kann ich den 'hint' Wert setzen? Also bei MouseOver...
Bei mir steht als hint nur 'beispiel' über dem Icon bei OnMouseOver.

Wie kommts?

Kann mir jemand helfen wie ich den Text selber festlegen kann?

Vielen Dank schonmal!

MfG

Lui

_________________
Während der C Progga sich fragt wie er es machen soll, fragt der Delphi Progga sich was soll ich machen...
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 12.11.02 20:55 
Machst du es selber oder benutzt du eine Komponente? Ansonsten kuck mal hier: www.luckie-online.de...phi/win32apidl.shtml
Popov
Gast
Erhaltene Danke: 1



BeitragVerfasst: Di 12.11.02 21:54 
Ungetestet:

ausblenden Quelltext
1:
2:
  IconData.szTip := 'Der TrayIcon-MouseOver-Text';
  Shell_NotifyIcon(NIM_MODIFY, @IconData);


Der Variablen-Name ist hier IconData, sonst ändern.
Lui Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 84

Win XP, Win 2000, Linux
D7
BeitragVerfasst: Di 12.11.02 22:36 
Titel: Wieso kann ich die variable nicht nutzen?
Danke euch beiden für die schnelle Antwort!

Hab deinen Teil mal implementiert Popov, aber es läuft nicht.
Was ist das Problem die VAriablen deklaration?

Hier mal der source um besser durchblicken zu können:

ausblenden 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:
procedure TForm1.WndProc(var Message: TMessage);
var IconData: String;    //String etwa falsch?????? 
begin
  case Message.Msg of
    WM_TRAYMSG:
      case Message.lParam of
        WM_LBUTTONDBLCLK:
          begin
            // weg mit dem TNA-Symbol!
            Shell_NotifyIcon(NIM_DELETE,@NID);
            // den Taskbar-Button wieder anzeigen
            // (egal, wie der Status von "Shell_NotifyIcon" ist)
            ShowWindow(Application.Handle,SW_SHOW);
            // und das hier auch noch, um die Anwendung
            // zu aktivieren und ggf. in den Vordergrund
            // zu holen
            Application.Restore;      
            IconData.szTip := 'ICON TEXT';                   //'A' Text setzen...
            Shell_NotifyIcon(NIM_MODIFY, @IconData); //'B' Icon modifizieren
          end;
      end;
    else
      inherited WndProc(Message);
  end;
end;


Wäre dankbar wenn ihr mir da mal weiter helfen könntet...
Was hab ich falsch gemacht in den Zeilen 'A' und 'B'?

MfG

Lui

_________________
Während der C Progga sich fragt wie er es machen soll, fragt der Delphi Progga sich was soll ich machen...
Popov
Gast
Erhaltene Danke: 1



BeitragVerfasst: Di 12.11.02 23:15 
Was ich geschrieben habe ist lediglich eine Änderung, eine Modifikation. Es ändert sich nichts drann, daß du ein

Shell_NotifyIcon(NIM_ADD, @IconData);

haben muß und in einer Extraprozedur ein

Shell_NotifyIcon(NIM_MODIFY, @IconData);

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:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ShellApi, Menus, StdCtrls;

const WM_TRAYICON = WM_USER + 1;

type
  TForm1 = class(TForm)
    PopupMenu1: TPopupMenu;
    N11: TMenuItem;
    N21: TMenuItem;
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
      IconData : TNotifyIconData;
     procedure WMTrayIcon(var Message : TMessage); message WM_TRAYICON;
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.WMTrayIcon;
var p : TPoint;
begin
  if Message.LParam = WM_RBUTTONUP then begin
    GetCursorPos(p);
    PopupMenu1.Popup(p.x, p.y);
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  IconData.cbSize := SizeOf(IconData);
  IconData.Wnd := Self.Handle;
  IconData.uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP;
  IconData.hIcon := Application.Icon.Handle;
  IconData.uCallbackMessage := WM_TRAYICON;
  IconData.szTip := 'Der TrayIcon-MouseOver-Text';
  Shell_NotifyIcon(NIM_ADD, @IconData);
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  Shell_NotifyIcon(NIM_DELETE, @IconData);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  IconData.szTip := 'Der andere Text';
  Shell_NotifyIcon(NIM_MODIFY, @IconData);
end;

end.
Lui Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 84

Win XP, Win 2000, Linux
D7
BeitragVerfasst: Mi 13.11.02 19:38 
Titel: Vielen Dank!
Vielen Dank für den ausführlichen source werd ihn gleich mal implementieren.

Danke, danke,...

Ich meld mich nochmal, denke aber das wird nicht nötig sein.

Also nochmals vielen Dank!

MfG

Lui

_________________
Während der C Progga sich fragt wie er es machen soll, fragt der Delphi Progga sich was soll ich machen...