tool displaying win ids on mouseover

For everything that's not in any way related to PureBasic. General chat etc...
spot
User
User
Posts: 16
Joined: Fri Oct 10, 2003 9:20 pm
Location: switzerland
Contact:

tool displaying win ids on mouseover

Post by spot »

this could be of interest for any windows progammer. just found it in another forum:

"WinID allows to get the most important information about Windows control classes, styles, and window titles. All you need is to point mouse cursor to a window, or any of system or custom-created control."

http://dennisbabkin.com/php/download.php?what=WinID
-- spot | www.nothing.ch
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Post by freedimension »

RJP Computing
Enthusiast
Enthusiast
Posts: 202
Joined: Sun Apr 27, 2003 4:44 am
Location: Michigan, USA
Contact:

Post by RJP Computing »

This is also very helpful.

http://www.windows-spy.com/
-Ryan
RJP Computing

Ubuntu 8.10/WinXP, AMD Athlon 64 3000+, 1000MB RAM, AC 97 Audio, nVidia GeForce 7600GT 512MB
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: tool displaying win ids on mouseover

Post by PB »

I personally like "ShoWin" because it shows details for ANY window, even
ones that "WinID" doesn't, and also "invisible" windows that are not seen:

http://www.foundstone.com/resources/proddesc/showin.htm

I'll have to check out the other suggestions to see how they fare. :)
Hi-Toro
Enthusiast
Enthusiast
Posts: 269
Joined: Sat Apr 26, 2003 3:23 pm

Post by Hi-Toro »

Weirdly enough, I wrote one of these in PB last night! Should be very easy to add more information to (and display the information in a better way than I'm doing here)...

Code: Select all


OpenWindow (0, 200, 200, 500, 200, #PB_Window_SystemMenu, "WindowInfo")

SetTimer_ (WindowID (), 0, 100, 0)

Repeat

    Select WaitWindowEvent ()
    
        Case #WM_TIMER
        
            GetCursorPos_ (@p.POINT)
            source = WindowFromPoint_ (p\x, p\y)
            If source <> WindowID ()
                GetWindowText_ (source, ReAllocateMemory (0, 255), 255)
                title$ = PeekS (MemoryID ())
                GetClassName_ (source, ReAllocateMemory (0, 255), 255)
                class$ = PeekS (MemoryID ())
                SetWindowText_ (WindowID (), title$ + " [Class: " + class$ + "]")
            Else
                SetWindowText_ (WindowID (), "WindowInfo's own window")
            EndIf
            
        Case #PB_Event_CloseWindow
        
            End
            
    EndSelect
    
ForEver
James Boyd
http://www.hi-toro.com/
Death to the Pixies!
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> I wrote one of these in PB last night

Hi-Toro, your example doesn't get the details of all windows, whereas the
app I mentioned ("ShoWin") does. For example: (In Win 98 SE), open the
"Taskbar & Start Menu" item, select "Start Menu Programs", and try to get
the info of the buttons etc inside the FrameGadgets. Only ShoWin seems
to be able to get such info. I've been trying to also do this for ages, and I
was hoping your example could do it, but no. :( Anyone know how?
Hi-Toro
Enthusiast
Enthusiast
Posts: 269
Joined: Sat Apr 26, 2003 3:23 pm

Post by Hi-Toro »

Well, you can get all windows like this:

Code: Select all

Procedure ListWindows (window, parameter)

    GetClassName_ (window, ReAllocateMemory (0, 255), 255)
    class$ = PeekS (MemoryID ())

    GetWindowText_ (window, ReAllocateMemory (0, 255), 255)
    title$ = PeekS (MemoryID ())

    FreeMemory (0)
    
    Debug Chr (34) + title$ + Chr (34) + " / Class: " + class$
    
    ProcedureReturn #TRUE
    
EndProcedure

EnumWindows_ (@ListWindows (), 0)
James Boyd
http://www.hi-toro.com/
Death to the Pixies!
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> you can get all windows like this

Nope, still doesn't show all window classes and text. :( Thanks anyway.
Hi-Toro
Enthusiast
Enthusiast
Posts: 269
Joined: Sat Apr 26, 2003 3:23 pm

Post by Hi-Toro »

You mean it doesn't show child windows (ie. 'gadgets')? I should be able to do that...
James Boyd
http://www.hi-toro.com/
Death to the Pixies!
Hi-Toro
Enthusiast
Enthusiast
Posts: 269
Joined: Sat Apr 26, 2003 3:23 pm

Post by Hi-Toro »

This code lists all open windows, including hidden ones and sub-windows. Turn Debug on! Note that ListChildWindows is called recursively on each child-window, using the 'parameter' variable to track 'depth'...

General non-GUI code here...

Code: Select all


; List top-level windows' children (called by ListWindows)...

Procedure ListChildWindows (window, parameter)

    GetClassName_ (window, ReAllocateMemory (0, 255), 255) 
    class$ = PeekS (MemoryID ()) 

    GetWindowText_ (window, ReAllocateMemory (0, 255), 255) 
    title$ = PeekS (MemoryID ()) 

    FreeMemory (0) 
    
    For a = 1 To parameter
        sub$ = sub$ + "--------"
    Next
    
    Debug sub$ + ">" + Chr (34) + title$ + Chr (34) + " / Class: " + class$ 

    EnumChildWindows_ (window, @ListChildWindows (), parameter + 1)

    ProcedureReturn #TRUE
    
EndProcedure

; List top-level windows...

Procedure ListWindows (window, parameter) 

    GetClassName_ (window, ReAllocateMemory (0, 255), 255) 
    class$ = PeekS (MemoryID ()) 

    GetWindowText_ (window, ReAllocateMemory (0, 255), 255) 
    title$ = PeekS (MemoryID ()) 

    FreeMemory (0) 
    
    Debug ""
    Debug "------------------------------------------------------------------------"
    Debug Chr (34) + title$ + Chr (34) + " / Class: " + class$ 
    Debug "------------------------------------------------------------------------"
    
    EnumChildWindows_ (window, @ListChildWindows (), 1)
    
    ProcedureReturn #TRUE 
    
EndProcedure 

EnumWindows_ (@ListWindows (), 0)

GUI code with tiny fix (a bit hard-coded to this tree gadget, I'm afraid)...

Code: Select all


#TREEGADGET = 0

Procedure ListChildWindows (window, parameter)

    GetClassName_ (window, ReAllocateMemory (0, 255), 255) 
    class$ = PeekS (MemoryID ()) 

    GetWindowText_ (window, ReAllocateMemory (0, 255), 255) 
    title$ = PeekS (MemoryID ()) 

    If title$ = ""
        title$ = "[Unnamed]"
    EndIf

    FreeMemory (0) 

    OpenTreeGadgetNode (#TREEGADGET)
        AddGadgetItem (#TREEGADGET, -1, title$ + " [" + class$ + "]")
        EnumChildWindows_ (window, @ListChildWindows (), 0)
    CloseTreeGadgetNode (#TREEGADGET)
    
    ProcedureReturn #TRUE
    
EndProcedure

Procedure ListWindows (window, parameter) 

    GetClassName_ (window, ReAllocateMemory (0, 255), 255) 
    class$ = PeekS (MemoryID ()) 
    GetWindowText_ (window, ReAllocateMemory (0, 255), 255) 
    title$ = PeekS (MemoryID ()) 

    If title$ = ""
        title$ = "[Unnamed]"
    EndIf

    FreeMemory (0) 

    OpenTreeGadgetNode (#TREEGADGET)
        AddGadgetItem (#TREEGADGET, -1, title$ + " [" + class$ + "]")
        EnumChildWindows_ (window, @ListChildWindows (), 1)
    CloseTreeGadgetNode (#TREEGADGET)

    ProcedureReturn #TRUE 

EndProcedure 

Procedure WinHook (WindowID, Message, wParam, lParam)
    If Message = #WM_SIZE
        ResizeGadget (#TREEGADGET, 0, 0, WindowWidth (), WindowHeight () - 25)
        RedrawWindow_ (GadgetID (#TREEGADGET), #NULL, #NULL, #RDW_INVALIDATE)
        ResizeGadget (1, 0, WindowHeight () - 25, WindowWidth (), 25)
    EndIf
    ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure

Procedure GetWindowTree ()
    ClearGadgetItemList (#TREEGADGET)
    OpenTreeGadgetNode (#TREEGADGET)
    AddGadgetItem (#TREEGADGET, -1, "All windows...")
    EnumWindows_ (@ListWindows (), 0)
    CloseTreeGadgetNode (#TREEGADGET)
EndProcedure

OpenWindow (0, 0, 0, 400, 300, #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget, "All windows...")
CreateGadgetList (WindowID ())

TreeGadget (#TREEGADGET, 0, 0, WindowWidth (), WindowHeight () - 25)
GetWindowTree ()
SetGadgetItemState (0, 0, #PB_Tree_Expanded)

ButtonGadget (1, 0, WindowHeight () - 25, WindowWidth (), 25, "Update list...")

SetWindowCallback (@WinHook ())

Repeat

    Select WaitWindowEvent ()
        Case #PB_Event_CloseWindow
            End
        Case #PB_Event_Gadget
            If EventGadgetID () = 1
                GetWindowTree ()
                SetGadgetItemState (0, 0, #PB_Tree_Expanded)
            EndIf
    EndSelect
    
ForEver

Last edited by Hi-Toro on Tue Dec 02, 2003 8:58 am, edited 2 times in total.
James Boyd
http://www.hi-toro.com/
Death to the Pixies!
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> You mean it doesn't show child windows (ie. 'gadgets')?

Yep, items inside FrameGadgets of other windows, etc.

> I should be able to do that...

(Checked new example): Yep, that's it! :D

Now I just have to get it working with WindowFromPoint and
I'm all done. Thanks heaps!
Hi-Toro
Enthusiast
Enthusiast
Posts: 269
Joined: Sat Apr 26, 2003 3:23 pm

Post by Hi-Toro »

There are now two code sections in my previous post -- I've added a more general example to the above code section, as well as a tiny fix to the GUI version...
James Boyd
http://www.hi-toro.com/
Death to the Pixies!
dc2000
New User
New User
Posts: 2
Joined: Tue Aug 16, 2005 1:25 am

Post by dc2000 »

Hey guys, did someone check this software http://dennisbabkin.com/php/download.php?what=WinID -- they seem to have a cool version now?
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

Sysinternal's Process Explorer does it too. And much more. And it's free.
http://www.sysinternals.com/Utilities/P ... lorer.html
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
dc2000
New User
New User
Posts: 2
Joined: Tue Aug 16, 2005 1:25 am

Post by dc2000 »

I thought this WinID is also free, isn't it? At least it didn't show any warnings to me.

I checked your link. Thanx it's good too, although it's a little bit different, more like Task Manager.
Post Reply