Thema: Delphi TNA Minimierungsproblem

Einzelnen Beitrag anzeigen

cruso
(Gast)

n/a Beiträge
 
#6

Re: TNA Minimierungsproblem

  Alt 1. Apr 2006, 15:20
Ok dann hier der gewünschte Codeausschnitt (Form3 ist das Hauptfenster allerdings besteht das Minimierungsproblem bei Form1; allerdings muss der Fehler hier irgendwo liegen):

Delphi-Quellcode:
procedure TForm3.FormCreate(Sender: TObject);
begin
  Form3.Visible:=False;
  ShowWindow(GetWindow(handle,GW_OWNER),SW_HIDE);
end;

procedure TaskBarAddIcon;
var tnid : TNOTIFYICONDATA ;
begin
    tnid.cbSize := sizeof(TNOTIFYICONDATA);
    tnid.Wnd := Form3.handle;
    tnid.uID := 1;
    tnid.uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP;
    tnid.uCallbackMessage := WM_TASKBAREVENT;
    tnid.hIcon := form1.image2.picture.icon.handle;
    strcopy(tnid.szTip,'bla');
    Shell_NotifyIcon(NIM_ADD, @tnid);
end;

procedure TForm3.WMTASKBAREVENT(var message: TMessage);
var point : TPoint;
begin
    case message.LParamLo of
         WM_LBUTTONDBLCLK : begin
                                 form1.show;
                            end;
         WM_RBUTTONDOWN : begin
                                 SetForegroundWindow(Handle);
                                 GetCursorPos(point);
                                 popupmenu1.popup(point.x,point.y);
                            end;
    end;
end;

procedure TForm3.Timer1Timer(Sender: TObject);
begin
     inc(count);
     if count = 3 then begin
        self.hide;
        timer1.enabled := false;
        TaskBarAddIcon;
     end;
end;

procedure TaskBarRemoveIcon;
var tnid : TNOTIFYICONDATA ;
begin
    tnid.cbSize := sizeof(TNOTIFYICONDATA);
    tnid.Wnd := Form3.handle;
    tnid.uID := 1;
    Shell_NotifyIcon(NIM_DELETE, @tnid);
end;

procedure TForm3.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  TaskBarRemoveIcon;
end;

procedure TForm3.Beenden1Click(Sender: TObject);
begin
  close;
end;
  Mit Zitat antworten Zitat