Autor Beitrag
TheNeon
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 408

Windows
VS2010 C#
BeitragVerfasst: Di 20.05.03 15:04 
Holla,

gibt es eine Möglichkeit ein Fenster mit ShellExecute aufzurufen und es beispielsweise bildschirmzentriert darzustellen?
djmasi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 54

Win XP Prof. Tablet PC Edition 2005
D7 Enterprise
BeitragVerfasst: Di 20.05.03 15:43 
Ja mit
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
SetWindowPos(
    HWND hWnd,  // handle of window
    HWND hWndInsertAfter, // placement-order handle
    int X, // horizontal position
    int Y, // vertical position
    int cx, // width
    int cy, // height
    UINT uFlags // window-positioning flags
   );

. Dazu brauchst Du das Handle von dem Prog. Bekommst es mit EnumWindowsProc. Mit
GetSystemMetrics(SM_CXSCREEN)
bzw
ausblenden Delphi-Quelltext
1:
GetSystemMetrics(SM_CYSCREEN)					

bekommst Du die Bildschirmdaten. Das dann berechnen sollte nicht schwer sein :)
TheNeon Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 408

Windows
VS2010 C#
BeitragVerfasst: Di 20.05.03 17:50 
erm .......... tja ........ :roll:

Problem:
danke für die gute Antwort, allerdings bin ich noch nicht ganz fit in Sachen "handle" ......

... wenn mir also jemand ein Beispiel geben könnte für EmunWindowsProc wäre ich sehr dankbar ....... auch verstehe ich nicht ganz bei SetWindowPos den 2. und letzten Parameter.

die Delphi-Hilfe hat mich nicht unbedingt weitergebracht ...... da dort auch keine Beispiele drin sind, aus denen ich mir Wissen / Infos saugen kann :?
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Di 20.05.03 18:31 
Hi!

Auf den msdn Seiten sind die API Funktion dokumentiert:

msdn.microsoft.com/l...ons/setwindowpos.asp

Beispiele zu EnumWindows findest du sicher im Forum oder bei
Freund Google:

groups.google.ch/gro...q=EnumWindows+Delphi
TheNeon Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 408

Windows
VS2010 C#
BeitragVerfasst: Di 20.05.03 19:36 
SetWindowPos ist nun klar, aber EnumWindow ist immernoch mehr als ein Rätsel :cry:
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 20.05.03 20:49 
Kann man bei CreateProcess nicht in einer Struktur die Position angeben?
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mi 21.05.03 09:30 
Luckie hat folgendes geschrieben:
Kann man bei CreateProcess nicht in einer Struktur die Position angeben?

Aber diese Postitionsangaben werden von vielen Anwendungen überschrieben weil diesen Anwendungen das Fenster an die Position setzten an welcher ich das Fenster vorher geschlossen habe.

Gruß
Tino
TheNeon Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 408

Windows
VS2010 C#
BeitragVerfasst: Mi 21.05.03 11:53 
:wave:

eine kleine Bitte:

falls jemand in seinem Programm EnumWindow oder derartiges benutzt, köntte ich den Teil hier gepostet bekommen?

Ich kappier das ganze Zeugs nicht so richtig. :cry: :cry:

In der Zwischenzeit werde ich mich an der eigenen Nase packen und etwas nachholen müssen.

danke :(
djmasi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 54

Win XP Prof. Tablet PC Edition 2005
D7 Enterprise
BeitragVerfasst: Mi 21.05.03 13:06 
Servus,
vielleicht hilft Dir das noch etwas. Mußt es halt nach Deinen Wünschen modifizieren :wink:
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:
...
var  TListe     : TList;
...
function EnumWindowsProc(WND: HWND; LParam: LPARAM): BOOL; stdcall;


//-Liste mit Fensterhandles füllen-\\
function EnumWindowsProc(WND: HWND; LParam: LPARAM): BOOL; stdcall;
var PLW: ^HWND;
begin
  Result := True;
  If IsWindow(WND) and ((IsWindowVisible(WND) {or IsIconic(WND)}and
    ((GetWindowLong(WND, GWL_HWNDPARENT) = 0or
     (GetWindowLong(WND, GWL_HWNDPARENT) = GetDesktopWindow)) and
     (GetWindowLOng(WND, GWL_EXSTYLE) and WS_EX_TOOLWINDOW = 0)) Then begin
       If Assigned(TListe) Then begin
         new(PLW);
         PLW^ := WND;
         TListe.Add(PLW);
       end;
     
  end;
end;
//-Liste mit Fensterhandles füllen-\\

...
procedure irgendwas; //z.B. TForm1.Creat
begin
  TListe          := TList.Create;
  EnumWindows(@EnumWindowsProc,0);
end;
...

//-Taskmanager mit Tasks füllen-\\
procedure TTaskListe.Zeigen(Sender: TObject);
var Title: array[0..255of Char;
    lauf : Word;
begin
  For lauf := 0 To TListe.Count - 1 do begin
    GetWindowText(HWND((TListe.Items[lauf])^), Title, 256);
    If (Title <> 'GDI+ Window'and (Title <> 'Taskmanager'Then begin
        FensterHandle := HWND((TListe.Items[lauf])^);
        //z.B. noch ne Listbox füllen?
    end;
  end;
end;
//-Taskmanager mit Tasks füllen-\\