Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Letzte Anwendung aktivieren (https://www.delphipraxis.net/4769-letzte-anwendung-aktivieren.html)

sakura 11. Mai 2003 13:25


Letzte Anwendung aktivieren
 
Hi DPler,

wie kann ich eigentlich rausfinden, welche der aktuell laufenden Anwendungen die nächste wäre, wenn der Benutzer einfach mit [Alt]+[Tab] wechseln würde. Und wie kann ich diese Anwendung in den Vordergrund holen und als aktive setzen?

...:cat:...

Motzi 11. Mai 2003 13:41

Also IMHO enthält die Alt-Tab Liste nur jene Fenster die auch in der Taskleiste aufscheinen und zwar in der Reihenfolge des Z-Orders des Desktops.. (hoffe man kennt sich aus was ich meine ;) )

Luckie 11. Mai 2003 13:43

Genau weiß ich es auch nicht. Aber ist das nicht die z-Order? dann kuck dir mal in deiner Anwendung WM_ACTIVATE an:
Zitat:

wParam
The low-order word specifies whether the window is being activated or deactivated. This parameter can be one of the following values. The high-order word specifies the minimized state of the window being activated or deactivated. A nonzero value indicates the window is minimized.
WA_ACTIVE
Activated by some method other than a mouse click (for example, by a call to the SetActiveWindow function or by use of the keyboard interface to select the window).
WA_CLICKACTIVE
Activated by a mouse click.
WA_INACTIVE
Deactivated.
lParam
Handle to the window being activated or deactivated, depending on the value of the wParam parameter. If the low-order word of wParam is WA_INACTIVE, lParam is the handle to the window being activated. If the low-order word of wParam is WA_ACTIVE or WA_CLICKACTIVE, lParam is the handle to the window being deactivated. This handle can be NULL.

sakura 11. Mai 2003 13:44

Ich weiss was Du meinst, ich diese Liste meine ich auch. Trotzdem habe ich irgendwie eine Blockierung und komme da nicht ran. :roll:

...:cat:...

Daniel B 11. Mai 2003 13:45

Hallo,

in den Vordergrund bringen könntest Du es damit, aber wie man das nächste findet weiss ich jetzt auch nicht.
Delphi-Quellcode:
SetForegroundWindow(Application.Handle);
Grüsse, Daniel :hi:

nailor 11. Mai 2003 13:50

Wie siehts aus mit

Zitat:

Zitat von So eine Datei von MS
The GetNextWindow function retrieves the handle of the next or previous window in the Z order. The next window is below the specified window; the previous window is above. If the specified window is a topmost window, the function retrieves the handle of the next (or previous) topmost window. If the specified window is a top-level window, the function retrieves the handle of the next (or previous) top-level window. If the specified window is a a child window, the function searches for a handle of the next (or previous) child window.

dann gibts da noch mehr, mit deren Kombination das dann sogar sakura schaffen sollte ;)

Daniel B 11. Mai 2003 13:51

Hallo,

jetzt hab ich wegen Dir Google angeworfen. Du schuldest mir was. ;)

Vielleicht findest Du es hiermit.

Grüsse, Daniel :hi:

nailor 11. Mai 2003 13:52

...sorry, die Info die ich hier stehen hatte war einfach nur falsch, deshalb hab ich sie mal wieder weg gemacht...

toms 11. Mai 2003 13:57

Hi,

Folgende 3 Möglicheiten fallen mir da ein:

1) WM_SETFOCUS und WM_KILLFOCUS in einem WH_CALLWNDPROC Hook abfragen.

2) WM_ACTIVATE hooken und die übergebenen Parameter abfragen (siehe Msdn)

3) In einem WH_SHELL Hook HSHELL_WINDOWACTIVATE abfangen.

Weitere Infos gibt's in der msdn.
Vielleicht geht's ja auch ohne Hooks?

toms 11. Mai 2003 14:10

Hier noch 2 Antworten aus den Google-PAQs:

Zitat:

There is no really reliable way to do that in Win32. What you can try is

wnd:= GetWindow( yourform.handle, GW_HWNDNEXT );

It will return the window beneath yours in the Z order. That may or may not be
the last active window (usually it will be).
(P. Below)


Zitat:

I've tried to track the active windows using hooks, but was not really
successfull up to now.
WH_SHELL - seemed to be the most promising, but did not work as documented

WH_SHELL using Shell32's ShellHookProc as the Hook Proc (undocumented),
worked once, never again
WH_CBT - NT hang after installing the system-wide hook, I must be doing
something wrong
WH_CALLWNDPROC + WH_GETMESSAGE and then tracking WM_ACTIVATEAPP - got way
to many notifications
(Alex Hekstra)


Alle Zeitangaben in WEZ +1. Es ist jetzt 08:19 Uhr.

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