Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Probleme beim Finden eines Window-Handels (https://www.delphipraxis.net/5729-probleme-beim-finden-eines-window-handels.html)

thomasdrewermann 16. Jun 2003 21:56


Probleme beim Finden eines Window-Handels
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hi,
ich versuche die TrayIcons alle auszublenden. Die Klasse der Trayicons heisst "TrayNotifyWnd". Ich habe den Screenshot des X-Spys angehängt. Wie lautet der zugehörige Findwindow befehl?

http://www.delphipraxis.net/attached.../bild1_653.gif

MFG
Thomas

Christian Seehase 16. Jun 2003 22:00

Moin Thomas,

das sollte mit FindWindow gehen.
Hier kannst Du den Text, die Klasse oder auch beides angeben.

thomasdrewermann 16. Jun 2003 22:02

Hi Christian,
Habe ich auch versucht aber ich bekommen als Handle 0 zurück. Der findet die Klasse nich. Vielleicht liegt das daran das es eine ebene tiefer eingeordnet ist?

Hier der code:
Delphi-Quellcode:
showwindow(Findwindow('TrayNotifyWnd',''),SW_HIDE);
MFG
Thomas

Christian Seehase 16. Jun 2003 22:16

Moin Thomas,

stimmt, müsste ein Child von Shell_TrayWnd sein.

[EDIT]
Also erst das Shell_TrayWnd mit FindWindow, dann das andere mit EnumChildWindows.
[/EDIT]

thomasdrewermann 16. Jun 2003 22:16

Hi Christian,
Wie komme ich denn an den Child ran?

MFG
Thomas

thomasdrewermann 16. Jun 2003 22:39

Irgendwie kommich mit dieser Deklaration nich klar:
Zitat:

The EnumChildWindows function enumerates the child windows that belong to the specified parent window by passing the handle to each child window, in turn, to an application-defined callback function. EnumChildWindows continues until the last child window is enumerated or the callback function returns FALSE.

Syntax

BOOL EnumChildWindows(HWND hWndParent, WNDENUMPROC lpEnumFunc, LPARAM lParam);

Parameters

hWndParent
[in]
Handle to the parent window whose child windows are to be enumerated. If this parameter is NULL, this function is equivalent to EnumWindows.

Windows 95/98/Me: hWndParent cannot be NULL.

lpEnumFunc
[in] Pointer to an application-defined callback function. For more information, see EnumChildProc.
lParam
[in] Specifies an application-defined value to be passed to the callback function.
Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.




Remarks

If a child window has created child windows of its own, EnumChildWindows enumerates those windows as well.

A child window that is moved or repositioned in the Z order during the enumeration process will be properly enumerated. The function does not enumerate a child window that is destroyed before being enumerated or that is created during the enumeration process.
Wie sieht denn jetzt ein Aufruf für meinen Fall aus?

MFG
Thomas

Christian Seehase 16. Jun 2003 22:43

Moin Thomas,

mit FindWindow suchst Du das Parent Fenster und mit EnumChildWindows gehst Du dann alle Child Fenster des gefundenen Handels durch.

Beispiele müsstest Du hier einige finden.

thomasdrewermann 16. Jun 2003 22:59

Problem Gelöst:
Delphi-Quellcode:
var a:HWND;

a:=findwindowex(findwindow('Shell_TrayWnd',''),findwindow('TrayNotifyWnd',''),'TrayNotifyWnd','');

showwindow(a,sw_hide);

MFG
Thomas

Christian Seehase 17. Jun 2003 10:22

Moin Thomas,

da FindWindow('TrayNotifyWnd','') Null zurückliefert, wie Du ja schon weiter oben festgestellt hast, kannst Du diesen Ausdruck auch gleich durch 0 ersetzen.

thomasdrewermann 17. Jun 2003 14:39

Stimmt,
ist mir garnicht eingefallen :oops:

Also die Exakte Version:
Delphi-Quellcode:
var a:HWND;

a:=findwindowex(findwindow('Shell_TrayWnd',''),0,'TrayNotifyWnd','');

showwindow(a,sw_hide);
MFG
thomas


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:20 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz