Autor Beitrag
demo88
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

Ubuntu 6.04, Win XP
Delphi 7
BeitragVerfasst: Fr 02.09.05 09:08 
Wie kann ich denn eine Form suchen?

Ich will das so machen wie z.B. mit "Findcomponent", kenne die function aber nicht.

_________________
"Das ist kein Bug, das ist ein Feature..."
Raffo
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 300



BeitragVerfasst: Fr 02.09.05 10:38 
Du kannst auch x:=FindWindow(nil,'MeinWindowFensterName'); verwenden dann kriegst Du ein Handle // oder auch nicht wenns nicht existiert.
demo88 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

Ubuntu 6.04, Win XP
Delphi 7
BeitragVerfasst: Fr 02.09.05 11:19 
also ich hab das jetzt so gemacht (funktioniert nicht):
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
function FindAWindow(name: string): THandle;
begin
  Result:=FindWindow(nil, Pchar(name));
end;

handle:=FindAWindow(Form3.ClientDataSet1.FieldByName('content').AsString);
if handle>0 then
  begin
    PostMessage(handle, WM_COMMAND, SW_SHOW, 0);
  end;


Das handle ist auch grösser als 0 aber trotzdem zeigt er das fenster nicht an :?:

_________________
"Das ist kein Bug, das ist ein Feature..."
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Fr 02.09.05 11:37 
Hallo,

eine Kurzfassung zum Anpassen:
ausblenden Delphi-Quelltext
1:
TForm(Application.FindComponent('Form2')).Show;					

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
demo88 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

Ubuntu 6.04, Win XP
Delphi 7
BeitragVerfasst: Fr 02.09.05 12:02 
dabei zeigt er aber immer eine EAccesViolation an :(

_________________
"Das ist kein Bug, das ist ein Feature..."
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Fr 02.09.05 12:35 
Hallo,

vermute das die Form noch nicht erstellt ist, also kann sie nicht gefunden werden, und Du erzeugts dadurch eine Zugriffsverletzung.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var aForm : TForm;
    s     :string;
begin
  s := 'Form2';
  aForm := TForm(Application.FindComponent('Form2'));
  if aForm <> nil then
    aForm.Show
    else
      showmessage(s+' wurde nicht gefunden.');

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
demo88 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

Ubuntu 6.04, Win XP
Delphi 7
BeitragVerfasst: Fr 02.09.05 12:41 
ja du hast recht, ie form wurde noch nicht erstellt.
aber wie lass ich sie denn jetzt anzeigen?

_________________
"Das ist kein Bug, das ist ein Feature..."
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: So 04.09.05 13:43 
Hallo,

indem Du sie vorher erstellst :wink:
Werden die Forms dynamisch erstellt?
Oder hast Du sie unter Projekt / Optionen in der Liste 'Autom. Formularerstellung' entfernt?

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )