Entwickler-Ecke
Windows API - Tray Icon - Text dynamisch
fuba - Do 15.02.07 12:10
Titel: Tray Icon - Text dynamisch
Hi leute,
Ich habe nen kleines prog gemacht, das alle paar Minuten was bestimmtes machen soll, wenn es aktiv ist.
Dieses prog ist immer minimiert im Tray und würde gerne den Tray text @ laufzeit ändern.
Sollte ca. so sein (im Tray Text):
blabla programm - Status: Aktiv
blabla programm - Status: Inaktiv
Habe für tray icon einen fertigen code genommen:
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:
| Procedure TForm1.ApplicationMinimize(Sender: TObject); var NotifyIconData: TNotifyIconData; Owner : HWnd; begin Fillchar(NotifyIconData,Sizeof(NotifyIconData),0); NotifyIconData.cbSize := Sizeof(NotifyIconData); NotifyIconData.Wnd := Handle; NotifyIconData.uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP; NotifyIconData.uCallbackMessage := WM_TASKABAREVENT; NotifyIconData.hIcon := Application.Icon.Handle; NotifyIconData.szTip := 'blabla programm - Status:'; Shell_NotifyIcon(NIM_ADD, @NotifyIconData);
Owner:=GetWindow(Handle,GW_OWNER); ShowWindow(Owner,SW_HIDE); end;
Procedure TForm1.ApplicationMaximize(Sender: TObject); var NotifyIconData: TNotifyIconData; begin FillChar(NotifyIconData,Sizeof(NotifyIconData),0); NotifyIconData.cbSize := Sizeof(NotifyIconData); NotifyIconData.Wnd := Self.Handle; NotifyIconData.uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP; NotifyIconData.uCallbackMessage := WM_TASKABAREVENT; NotifyIconData.hIcon := Application.Icon.Handle; NotifyIconData.szTip := 'Punkt'; Shell_NotifyIcon(NIM_DELETE, @NotifyIconData); end; |
das ist der code indem der Tray Text steht:
Delphi-Quelltext
1:
| NotifyIconData.szTip := 'blabla programm - Status:'; |
wie kann ich das per laufzeit ändern?
danke für hilfe!
Moderiert von
Tino: Topic aus VCL (Visual Component Library) verschoben am Mo 30.04.2007 um 20:30
Delete - Mo 30.04.07 19:43
Wie siehts denn aber aus, wenn ich Zahlen dort einfügen möchte?
Also in meinem Fall ist es eine Zeitanzeige...
danke
Delete - Di 01.05.07 14:31
ja, ... ne.
das mein ich nich.
das weiss ich ja bereits.
Das Problem liegt darin, dass ich eine unbestimmte Zahlenfolge eingeben lassen möchte.
also eher etwas im Sinne von:
[highlight]IconData.szTip := 'verbleibende Restzeit: ' + TimeToStr(remTime);
Shell_NotifyIcon(NIM_Modify, @IconData);[/highlight]
(Auszug)
dann kommt eine Fehlermeldung von wegen inkompatible Typen
??
danke
EDIT//
ach mensch, mädels, ihr macht mich fertig...
habs jetze selber raus bekommen.
StrCopy(IconData.szTip, pchar(TimeToStr(remTime)))
trotzdem danke
tschausen
jaenicke - Mi 02.05.07 12:44
Oder:
Delphi-Quelltext
1:
| IconData.szTip := PChar('verbleibende Restzeit: ' + #13#10 + TimeToStr(remTime)); |
Letztendlich kommt es auf das gleiche raus.
Entwickler-Ecke.de based on phpBB
Copyright 2002 - 2011 by Tino Teuber, Copyright 2011 - 2025 by Christian Stelzmann Alle Rechte vorbehalten.
Alle Beiträge stammen von dritten Personen und dürfen geltendes Recht nicht verletzen.
Entwickler-Ecke und die zugehörigen Webseiten distanzieren sich ausdrücklich von Fremdinhalten jeglicher Art!