Results 1 to 15 of 15

Thread: Get the Hwnd's of TaskBar

Hybrid View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2005
    Posts
    16

    Unhappy Re: Get the Hwnd's of TaskBar

    Well.. with that i only can get the Hwnd of the ToolBar and how many buttons have it with TB_BUTTONCOUNT. But i can't get the Hwnds yet

    What i really need is get and identifier to know what button is from what window. I can get the Text with AccesibleObjects but 2 windows can have the same text, so is not good

    Edit : I can get the Text when move the mouse with AccessibleObjects, but i need the Hwnd

  2. #2
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    708

    Re: Get the Hwnd's of TaskBar

    Here you go, add these snippets:
    This is for VB.NET.
    VB6, change integers to long.


    VB Code:
    1. Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Integer, ByVal hWnd2 As Integer, ByVal lpsz1 As String, ByVal lpsz2 As String) As Integer


    VB Code:
    1. Dim tWnd As Integer
    2. Dim bWnd As Integer
    3. tWnd = FindWindow("Shell_TrayWnd", vbNullString)
    4. bWnd = FindWindowEx(tWnd, bWnd, "BUTTON", vbNullString)

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Oct 2005
    Posts
    16

    Red face Re: Get the Hwnd's of TaskBar

    With this i can get the number of buttons in the Task-Toolbar

    In Win2k (here in Work) is not same than WinXP (in home). In fact, is different if you have the QuickIcons (is another Toolbar)

    VB Code:
    1. Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, _
    2. ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    3. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
    4. (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    5. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal _
    6. hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    7.  
    8. Private Const WM_USER = &H400
    9. Private Const TB_BUTTONCOUNT = (WM_USER + 24)
    10.  
    11. Private Sub Form_Load()
    12.  twnd = FindWindow("Shell_TrayWnd", vbNullString)
    13.  twnd = FindWindowEx(twnd, 0&, "ReBarWindow32", vbNullString)
    14.  twnd = FindWindowEx(twnd, 0&, "MsTaskSwWClass", vbNullString)
    15.  twnd = FindWindowEx(twnd, 0&, "ToolbarWindow32", vbNullString)
    16.  
    17.  MsgBox "Buttons : " & SendMessage(twnd, TB_BUTTONCOUNT, 0&, 0&)
    18. End Sub

    That is for another stuff, because is not related to the Task-Toolbar. Is related only to the Shell_TrayWnd

    VB Code:
    1. bWnd = FindWindowEx(tWnd, bWnd, "BUTTON", vbNullString)

    Please, if somebody wants to help then give some REAL samples

    As i say, i can get the Task-Toolbar, the number of Buttons and the Text of every Button (with AA). I'm just want to get the Hwnd's or some identifier to i can know what button is for what window
    Last edited by sunco; Oct 11th, 2005 at 09:53 AM. Reason: some corrections on the text. too long strings

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width