Tray_Icon aufpoppen/auslesen

Fragen rund um diverse Windows-Versionen, ihr Verhalten unter Xbase++ und den Umgang mit der API

Moderator: Moderatoren

Antworten
Benutzeravatar
AUGE_OHR
Marvin
Marvin
Beiträge: 12906
Registriert: Do, 16. Mär 2006 7:55
Wohnort: Hamburg
Hat sich bedankt: 19 Mal
Danksagung erhalten: 45 Mal

Tray_Icon aufpoppen/auslesen

Beitrag von AUGE_OHR »

hi,

wie auch schon im Thread http://www.xbaseforum.de/viewtopic.php?f=27&t=4422 geht es um FindWindow / GetWindow.

Code: Alles auswählen

LOCAL hwnd := DllCall("User32.dll", DLL_STDCALL, "FindWindowA","Shell_TrayWnd", Chr(0))
damit hätte ich schon mal das Handle wo die Tray_Icon sind.
lngStartMenuHand = FindWindow("Shell_TrayWnd", vbNullString)

'Get the handle to the first child window of the start menu.
lngChildHand = GetWindow(lngStartMenuHand, GW_CHILD)

'Loop through all siblings until we find the 'System Tray' (A.K.A. --> TrayNotifyWnd)
Do

lngClassNameLen = GetClassName(lngChildHand, strClass, Len(strClass))

'If it is the tray then store the handle.
If InStr(1, strClass, "TrayNotifyWnd"/"Lautstärke" ) Then
lngTrayHand = lngChildHand
Exit Do
End If
'If we didn't find it, go to the next sibling.
lngChildHand = GetWindow(lngChildHand, GW_HWNDNEXT)

Loop
es geht um das "Loop through" wo ich nicht weiss wie ich das machen soll ?

wie/was macht GetClassName() ? ist das sowas wie ":Childlist()" ?
Syntax
int WINAPI GetClassName(
__in HWND hWnd,
__out LPTSTR lpClassName,
__in int nMaxCount
);


Parameters
hWnd [in]
HWND

A handle to the window and, indirectly, the class to which the window belongs.
lpClassName [out]
LPTSTR

The class name string.
nMaxCount [in]
int

The length, in characters, of the buffer pointed to by the lpClassName parameter. The class name string is truncated if it is longer than the buffer and is always null-terminated.

Return Value
int

If the function succeeds, the return value is the number of characters copied to the specified buffer.

If the function fails, the return value is zero. To get extended error information, call GetLastError.
Ich mache das sonst mit WinID http://www.dennisbabkin.com/php/m_download.php (Empfehlung von Günter Beyes) und kann damit von jedem Part das Handle, "Title" und Parent Window ermitteln, aber ich würde es gerne mit Xbase++ machen ;)

wenn ich z.b. das Icon "Lautstärke" in der Taskleiste ansprechen will müsste ich

Code: Alles auswählen

LOCAL cTitle := "Lautstärke"
LOCAL hwnd := DllCall("User32.dll", DLL_STDCALL, "FindWindowA","Shell_TrayWnd", Chr(0))
LOCAL nEdithwnd := DllCall("User32.dll",DLL_STDCALL, "FindWindowExA",hWnd,, 0,cTitle,"")
aber da "habe" ich ja cTitle , aber wie funktioniert es über GetClassName() ?
gruss by OHR
Jimmy
Antworten