Autor Beitrag
DelphiNoob
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152

Win 2003 Server
D7 Ent
BeitragVerfasst: Mi 08.01.03 17:29 
... direkt minimieren und in TNA.

STOP! Bevor nun jemand schreit: "Suchfunktion", möge er doch erstmal die Finger still halten ;) ! Danke...

Ich weiß wie man ein Programm in der TNA anzeigt, nur habe ich ein Problem!

Wenn ich mein Programm starte, erscheint auch brav das Symbol in der Systray, und auch der Taskbar Button wird entfernt.

Alles schön und gut, nun will ich das der Form nicht mehr da ist. Also mit "Hide;" versucht. Tut sich nichts. Dann per ShowWindow und SW_HIDE. Tut sich auch nichts...

Ich will diese *piep* Form einfach weg haben, und nur noch das Icon in der Tray (also nix minimieren oder so...)!!!

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure TForm1.FormCreate(Sender: TObject);
begin

{ Added das Icon in die Tray }
TaskBarAddIcon;

{ Removed den Taskbutton }
ShowWindow( Application.Handle, SW_HIDE );
  SetWindowLong( Application.Handle, GWL_EXSTYLE,
                 GetWindowLong(Application.Handle, GWL_EXSTYLE) or
                 WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW);
ShowWindow( Application.Handle, SW_SHOW );

{ Hier hab ich alles versucht, und nun erstmal rausgenommen um euch um Rat zu fragen! }

end;


Plz Help!

PS.: Ich habe für obiges Problem schon die Suchfunktion benutzt. Also gehässige Kommentare in der Richtung bitte bei sich behalten, ausdrucken, und an die Wand hängen.

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mi 08.01.03 18:20 
lass dir mal den projektquelltext anzeigen (gibt denke ich im menüpunkt project) und lösche dann einfach die codee zeile form1.show;

und schon wird das forumular beim programmstart nicht mehr angezeigt !!!

_________________
In the beginning was the word.
And the word was content-type: text/plain.
DelphiNoob Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152

Win 2003 Server
D7 Ent
BeitragVerfasst: Mi 08.01.03 18:26 
Ähm ja...

ich hab mal versucht...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.


... die Zeile "Application.CreateForm(TForm1, Form1);" raus zu nehmen, dann tut sich aber nicht mehr viel...

Achso, und noch ne Frage: Wie schaff ich es, das wenn ich aufs icon in der TNA rechtsklicke Popupmenu XY angezeigt wird?

Thx

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.
DelphiNoob Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152

Win 2003 Server
D7 Ent
BeitragVerfasst: Mi 08.01.03 18:34 
Popup Menü Prob hab ich so gelöst... funzt auch...

Dank des Forums :)!

ausblenden Quelltext
1:
Menu.Popup((Mouse.CursorPos.X),(Mouse.CursorPos.Y));					
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mi 08.01.03 18:35 
nicht create rausnehmen !!! show rausnehmen !!!

_________________
In the beginning was the word.
And the word was content-type: text/plain.
DelphiNoob Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152

Win 2003 Server
D7 Ent
BeitragVerfasst: Mi 08.01.03 18:50 
Aber ich hab da doch kein Show!!!

Wenn ich auf Project ---> Quelltext anzeigen gehe, dann hab ich da:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
program AntiInisNew;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.


Hab ich nen Sehfehler oder wo is Show?

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.
Ex0rzist
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 550

Win XP Prof.
Mandrake 10.0

D6
BeitragVerfasst: Mi 08.01.03 19:17 
Probiere mal das in deiner Form1.Create-Prozedur: Application.ShowMainForm := False;

_________________
If accidentally read, induce vomitting.
DelphiNoob Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152

Win 2003 Server
D7 Ent
BeitragVerfasst: Mi 08.01.03 20:47 
Tut mir leid, das bring auch nichts...

Wie machen das denn Programme wie z.b. Kazaa oder so?

Ich meine, die verschwinden zwar beim Minimieren, aber der Form ist ja auch GANZ WEG.

?! How do ?!
DelphiNoob Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152

Win 2003 Server
D7 Ent
BeitragVerfasst: Mi 08.01.03 21:07 
Und der Tipp wirkt auch nicht:

www.swissdelphicente...de/showcode.php?id=7

Ich poste einfach mal den ganzen Source...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
program AntiInisNew;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.


ausblenden volle Höhe 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:
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:
unit Unit1;

interface

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

const
  WM_TASKBAREVENT = WM_USER+1;

type
  TForm1 = class(TForm)
    Menu: TPopupMenu;
    Beenden1: TMenuItem;
    Explorer1: TMenuItem;
    DosCommand1: TMenuItem;
    Systemtasten1: TMenuItem;
    DesktopFunktionen1: TMenuItem;
    SymboleAnAus1: TMenuItem;
    askleisteAnAus1: TMenuItem;
    StartbuttonAnAus1: TMenuItem;
    SystrayAnaus1: TMenuItem;
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    procedure WMTASKBAREVENT(var message: TMessage); 
      message WM_TASKBAREVENT;
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  mHandle: THandle;
implementation

{$R *.dfm}

procedure TForm1.WMTASKBAREVENT(var message: TMessage);
begin
  case message.LParamLo of
    WM_RBUTTONDOWN    : begin
                          Menu.Popup((Mouse.CursorPos.X),(Mouse.CursorPos.Y));
                        end;
  end;
end;

procedure TaskBarAddIcon;
var
  tnid: TNOTIFYICONDATA ;
begin
  with tnid do
  begin
    cbSize := sizeof(TNOTIFYICONDATA);
    Wnd := Form1.handle;
    uID := 1;
    uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP;
    uCallbackMessage := WM_TASKBAREVENT;
    hIcon := application.icon.handle;
  end;

  strcopy(tnid.szTip,'Anti INiS 1.2');
  Shell_NotifyIcon(NIM_ADD, @tnid);
end;

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

procedure TForm1.FormCreate(Sender: TObject);
begin

TaskBarAddIcon;

ShowWindow( Application.Handle, SW_HIDE );
  SetWindowLong( Application.Handle, GWL_EXSTYLE,
                 GetWindowLong(Application.Handle, GWL_EXSTYLE) or
                 WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW);
ShowWindow( Application.Handle, SW_SHOW );

end;

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

Initialization
  mHandle:=CreateMutex(nil,True,'Anti INiS 1.2');
  if GetLastError=ERROR_ALREADY_EXISTS then
    Halt;

finalization
  if mHandle<>0 then
    CloseHandle(mHandle)

end.


Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mi 08.01.03 21:19 
dann machs auf die mathode:
timer auf die kompo, timer zeit auf 0 ms stellen, im timer dann folgende action ausführen:
ausblenden Delphi-Quelltext
1:
2:
application.minimize;
timer1.enabled := false;

das ist zwar die holzhammer methode aber sie wirkt !!!

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
DelphiNoob Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152

Win 2003 Server
D7 Ent
BeitragVerfasst: Do 09.01.03 13:48 
Sowas hab ich mir auch schon überlegt.. das Problem ist nur, das du dann so ein kleinen Titelbalken mit einem [X] über dem Startbutton liegen hast.

Habs vorerst mal anders gelöst: Boarder = None, und dann beim Create Width und Heigth = 0.