Autor Beitrag
MisterBum83
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 245
Erhaltene Danke: 2

WIN XP
Delphi 6
BeitragVerfasst: Mo 27.09.04 17:11 
Hallo,
habe eine DLL geschrieben. Wie schaffe ich es, das die DLL nicht in der Taskleiste angezeigt wird.
Habe ich ONShow-Ereignis des Formular folgenden Code eingefügt, aber es ist trotzdem noch sichtbar. Woran kann das liegen oder hat einer eine andere Idee?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TFormMain.FormShow(Sender: TObject);
var Owner: HWnd;
begin
  Owner := GetWindow(Handle, GW_OWNER);
  ShowWindow(Owner, SW_HIDE);
end;




Gruß MisterBum

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt.
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Mo 27.09.04 17:50 
du musst das Application.handle nehmen

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
MisterBum83 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 245
Erhaltene Danke: 2

WIN XP
Delphi 6
BeitragVerfasst: Mo 27.09.04 18:04 
Hallo,
funktioniert leider auch nicht folgender Code:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TFormMain.FormShow(Sender: TObject);
var Owner: HWnd;
begin
  Owner := GetWindow(Application.Handle, GW_OWNER);
  ShowWindow(Owner, SW_HIDE);
end;



Vielen Dank für eure Hilfe...

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt.
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Mo 27.09.04 18:13 
robiers mal nur mit ShowWindow(Application.handle, SW_Hide);hat bei mir funktioniert

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
MisterBum83 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 245
Erhaltene Danke: 2

WIN XP
Delphi 6
BeitragVerfasst: Mo 27.09.04 18:23 
Dies funktioniert bei mir auch nicht.
Denk dran, ich arbeite mit einer DLL-Datei. Ich weis nicht, ob das dort so funktioniert...


Gruß und Dank
MisterBum
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 27.09.04 18:28 
Übergib der DLL das Application-Handle, dann kannst du es benutzten.
MisterBum83 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 245
Erhaltene Danke: 2

WIN XP
Delphi 6
BeitragVerfasst: Mo 27.09.04 18:30 
Wie meinst du das? Kannst du mir mit Code paar Tips geben?... :D
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Mo 27.09.04 21:23 
mach dir eine "InitProzedur" in der DLL, in der du das handle übergibts

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
kachel81
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63



BeitragVerfasst: Mi 29.09.04 13:30 
In die Projektdatei...

ausblenden 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:
  ...

uses
  ...

procedure Execute(var MyHandle: HWND);
var
  memHandle: THandle;
begin
  memHandle      := Application.Handle;
  try
    Application.Handle := MyHandle;
    // Hier Dein Forumular erzeugen und Modal anzeigen
    ...
  finally
    Application.Handle      := memHandle;
  end;
end;

exports
  Execute;

begin
end.
MisterBum83 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 245
Erhaltene Danke: 2

WIN XP
Delphi 6
BeitragVerfasst: Mi 29.09.04 14:45 
Super! Werds direkt heute abend versuchen und sagen, obs funktioniert!

Gruß und Dank...
MisterBum
MisterBum83 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 245
Erhaltene Danke: 2

WIN XP
Delphi 6
BeitragVerfasst: Mi 29.09.04 17:39 
Hat soweit funktioniert. Super!

Nur wenn ich jetzt die DLL schliesse, wird auch mein Eintrag in der Taskleiste geschlossen. Erst wenn ich mein Hauptprogramm minimiere und maximiere ist der Eintrag wieder da.

Einer ne Idee, wie ich das lösen kann?...

Vielen Dank für eure Hilfe
MisterBum
kachel81
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63



BeitragVerfasst: Do 30.09.04 18:12 
Poste mal bitte, wie Du die Prozedur callst und am besten auch, wie Du das ganze jetzt in der DLL gemacht hast (Init-Prozedur). Eigentlich sollte es da keine Probleme geben, wenn das Anwendungs-Handle sauber wieder zurückgegeben wird.
Sephiroth
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 102



BeitragVerfasst: Do 30.09.04 18:25 
Hier ein wenig Code wie ich das gelöst hab:

ausblenden 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:
procedure DLL_FormularAnzeigen(wnd : Hwnd); stdcall;
begin
  Application.Title := '';
  Application.CreateForm(TfrmHaupt, frmHaupt);
  try
    if Wnd = 0 then
      Wnd := GetActiveWindow;
    Application.Handle := Wnd;
    frmHaupt := TfrmHaupt.Create(Application);    
    try
      frmHaupt.ShowModal;
    finally
      frmHaupt.Release;
    end;
  except
    on E: Exception do
      Application.HandleException(E);
  end;
  Application.Handle := 0;
end;

....

exports DLL_FormularAnzeigen;


Der Aufruf sieht dann so aus:

ausblenden Quelltext
1:
DLL_EtikettFormularAnzeigen(Handle);					


kleiner Tip -> Wenn du dein Icon von der Hauptapplication beibehalten möchtest musst den code wie folgt erweitern:

ausblenden Quelltext
1:
2:
3:
4:
5:
    ...
    frmHaupt := TfrmHaupt.Create(Application);
    frmHaupt.Icon.Handle := LoadIcon(HInstance, 'MAINICON');
    try
    ...
MisterBum83 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 245
Erhaltene Danke: 2

WIN XP
Delphi 6
BeitragVerfasst: Fr 01.10.04 11:48 
Klasse,
das von Sephiroth hat funktioniert. Vielen Dank!!!

MisterBum