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: 106: 107: 108: 109: 110: 111:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Menus, ExtCtrls, StdCtrls;
const WM_TASKBAREVENT = WM_USER+1;
type TMain1 = class(TForm) Startbild1: TImage; Timer1: TTimer; PopupMenu1: TPopupMenu; Image2: TImage; Merkzettelanzeigen1: TMenuItem; N1: TMenuItem; Beenden1: TMenuItem; Konfiguration1: TMenuItem; N2: TMenuItem; procedure FormCreate(Sender: TObject); procedure Timer1Timer(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure Merkzettelanzeigen1Click(Sender: TObject); procedure Beenden1Click(Sender: TObject); private public procedure WMTASKBAREVENT(var message: TMessage); message WM_TASKBAREVENT; end;
var Main1: TMain1;
implementation uses shellapi, Unit2; var count : integer = 0;
{$R *.DFM}
procedure TMain1.WMTASKBAREVENT(var message: TMessage); var point : TPoint; begin case message.LParamLo of WM_LBUTTONDBLCLK : begin Merkzettel1.show; end; WM_RBUTTONDOWN : begin GetCursorPos(point); popupmenu1.popup(point.x,point.y); end; end; end;
procedure TaskBarAddIcon; var tnid : TNOTIFYICONDATA ; begin tnid.cbSize := sizeof(TNOTIFYICONDATA); tnid.Wnd := Main1.handle; tnid.uID := 1; tnid.uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP; tnid.uCallbackMessage := WM_TASKBAREVENT; tnid.hIcon := Main1.image2.picture.icon.handle; strcopy(tnid.szTip,'Freddy'); Shell_NotifyIcon(NIM_ADD, @tnid); end;
procedure TaskBarRemoveIcon; var tnid : TNOTIFYICONDATA ; begin tnid.cbSize := sizeof(TNOTIFYICONDATA); tnid.Wnd := Main1.handle; tnid.uID := 1; Shell_NotifyIcon(NIM_DELETE, @tnid); end;
procedure TMain1.FormCreate(Sender: TObject); begin ShowWindow(GetWindow(handle,GW_OWNER),SW_HIDE); end;
procedure TMain1.Timer1Timer(Sender: TObject); begin inc(count); if count = 3 then begin self.hide; timer1.enabled := false; TaskBarAddIcon; end; end;
procedure TMain1.FormClose(Sender: TObject; var Action: TCloseAction); begin TaskBarRemoveIcon; end;
procedure TMain1.Merkzettelanzeigen1Click(Sender: TObject); begin Merkzettel1.show end;
procedure TMain1.Beenden1Click(Sender: TObject); begin close; end;
end. |