Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Systray + Gauge1.Progress = FEHLOOOOR (https://www.delphipraxis.net/56864-systray-gauge1-progress-%3D-fehloooor.html)

A-M-X 12. Nov 2005 14:08


Systray + Gauge1.Progress = FEHLOOOOR
 
Huhu!!

Habe folgenden (teil)Code beim Minimieren meines Projektes und mein Problem ist , dass er ne Fehlermeldung bei dem Tooltip sagt:

Delphi-Quellcode:
procedure TForm1.ApplicationEvents1Minimize(Sender: TObject);
begin
if CheckBox1.Checked = true then
begin
  //Vorgang: Minimieren der Anwendung, Entfernung des Taskleisteneintrags
  //und Hinzufügen des Programmicons neben der Uhr
  Form1.FormStyle:=fsStayOnTop;
  Hide;
  with NIM do begin
    cbSize := SizeOf (nIM);
    Wnd := Handle;
    uID := 0;
    uFlags := NIF_ICON or NIF_MESSAGE or NIF_TIP;
    uCallbackMessage := IC_CLICK;
    hIcon := Application.Icon.Handle;
    szTip := Gauge1.Progress; //<--- DA T.T
  end;
  Shell_NotifyIcon(NIM_ADD, @NIM);
end
else
begin
end;
end;
Beim Markierten (" <--- DA T.T") wird eine Fehlermeldung gezeigt: Inkompatible Typen : Array und Integer;
mit IntToStr gehts auch ned :/

Neutral General 12. Nov 2005 14:15

Re: Systray + Gauge1.Progress = FEHLOOOOR
 
Da stellen sich die Fragen : Was ist NIM ? Was ist szTip ? Ist szTip ein Array of Integer ? dann musst du ein Index angeben...

A-M-X 12. Nov 2005 14:17

Re: Systray + Gauge1.Progress = FEHLOOOOR
 
so sieht der beispielcode einer homepage aus:

Delphi-Quellcode:
unit Unit1;

interface

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

const
  IC_CLICK = WM_APP + 201;

type
  TForm1 = class(TForm)
    ApplicationEvents1: TApplicationEvents;
    procedure ApplicationEvents1Minimize(Sender: TObject);
    private
      { Private-Deklarationen }
      procedure Systray(var sMsg: TMessage); message IC_CLICK;
    public
      { Public-Deklarationen }
    end;

var
  Form1: TForm1;
  NIM : TNotifyIconData;

implementation

{$R *.DFM}

procedure TForm1.Systray(var sMsg: TMessage);
begin
  // Vorgang: Klick auf das Icon neben der Uhr und Anzeige der Anwendung
  inherited;
  if (sMsg.LParam = WM_LBUTTONDOWN) then begin
    Show;
    Shell_NotifyIcon(NIM_DELETE, @NIM);
    Application.Restore; //zeigt die Anwendung wieder an
  end;
end;

procedure TForm1.ApplicationEvents1Minimize(Sender: TObject);
begin
  //Vorgang: Minimieren der Anwendung, Entfernung des Taskleisteneintrags
  //und Hinzufügen des Programmicons neben der Uhr
  Form1.FormStyle:=fsStayOnTop;
  Hide;
  with NIM do begin
    cbSize := SizeOf (nIM);
    Wnd := Handle;
    uID := 0;
    uFlags := NIF_ICON or NIF_MESSAGE or NIF_TIP;
    uCallbackMessage := IC_CLICK;
    hIcon := Application.Icon.Handle;
    szTip := 'Test-Programm';
  end;
  Shell_NotifyIcon(NIM_ADD, @NIM);
end;

end.

dahead 12. Nov 2005 14:21

Re: Systray + Gauge1.Progress = FEHLOOOOR
 
vielleicht:

szTip := @IntToStr(Gauge1.Progress)[1];

A-M-X 12. Nov 2005 14:23

Re: Systray + Gauge1.Progress = FEHLOOOOR
 
Zitat:

Zitat von dahead
vielleicht:

szTip := @IntToStr(Gauge1.Progress)[1];

"Inkompatible Typen: Array und Pointer"

T.T

dahead 12. Nov 2005 14:38

Re: Systray + Gauge1.Progress = FEHLOOOOR
 
mhh.

Delphi-Quellcode:
var
  HintText: String;
begin
  HintText := IntToStr(Gauge1.Progress);
  with NIM do
   begin
    Move(HintText[1], szTip, Length(szTip));
    Shell_NotifyIcon(NIM_MODIFY, @TrayIcon);
   end;
end;
kann das leider gerade nicht ausprobieren, könnte aber funktionieren.

A-M-X 12. Nov 2005 14:49

Re: Systray + Gauge1.Progress = FEHLOOOOR
 
öhm entweder habs ned geblickt oder es geht ned >.<

dahead 12. Nov 2005 14:57

Re: Systray + Gauge1.Progress = FEHLOOOOR
 
ich hab es wie folgt geschafft:

Delphi-Quellcode:
var
  tmpStr: String;
begin
  Form1.FormStyle:=fsStayOnTop;
  Hide;
  with NIM do begin
    cbSize := SizeOf (nIM);
    Wnd := Handle;
    uID := 0;
    uFlags := NIF_ICON or NIF_MESSAGE or NIF_TIP;
    uCallbackMessage := IC_CLICK;
    hIcon := Application.Icon.Handle;
    tmpStr := IntToStr(Gauge1.Position);
    Move(tmpStr[1], szTip, Length(szTip));
  end;
  Shell_NotifyIcon(NIM_ADD, @NIM);

A-M-X 12. Nov 2005 15:02

Re: Systray + Gauge1.Progress = FEHLOOOOR
 
cool das geht!! vielen dank!!

noch ne kleine frage: wenn die gauge nun hochgeht und ich drüberfahr mit der maus , wie geht es , dass es dauernd aktuallisiert? also ned nur den wert der gauge nimmt , der beim minimieren auftritt

dahead 12. Nov 2005 15:20

Re: Systray + Gauge1.Progress = FEHLOOOOR
 
meinst du den hint/tooltip?

wenn ja, dann musst du den hint halt ständig aktualisieren (Gauge1.Hint := xx).

um die aktualisierung (für die gesamte application) zu ändern könntest du folg. befehle verwenden:

Application.HintHidePause := xx;
Application.HintPause := xx;


Alle Zeitangaben in WEZ +1. Es ist jetzt 05:15 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz