5,139,275 members and growing! (11,923 online)
Email Password   helpLost your password?
Web Development » Applications & Tools » Tools with source code     Intermediate

MiniSpy

By .dan.g.

A dynamic window attribute viewer to replace Spy++
VC6, VC7, C++Windows, Win2K, WinXP, MFC, VS6, VS, Dev

Posted: 12 Jan 2002
Updated: 27 Jul 2002
Views: 126,579
Announcements



Search    
Advanced Search
Sitemap
42 votes for this Article.
Popularity: 7.54 Rating: 4.64 out of 5
1 vote, 4.5%
1
0 votes, 0.0%
2
1 vote, 4.5%
3
1 vote, 4.5%
4
19 votes, 86.4%
5

Sample Image - MiniSpy.jpg

Introduction

(Rev 2.0)

I often use Spy++ to track window messages but have rarely used it to look at the attributes of a window.

When i have used it, I've found using the finder tool to be a really awkward device because it presents a static interface to what i find to be a much more dynamic activity.

I decided therefore to see if I could devise an alternative interface which would allow me to look at a window's attributes with the minimum of fuss and bother.

The result is MiniSpy.

There's nothing very special about it, but it does provide the following features:

  • All attributes are visible in one pane
  • Dynamically updates as you drag it around
  • Displays control specific styles for all of the standard windows and common controls separately to the standard window styles.
  • Provides a filter drop-down so that if you have registered you own window class and it is based on a standard control class you can manually select the base window class to see the control styles
  • 'Refresh' button for refreshing the current window's attributes
  • Provides tooltips to view long rows

History

New Features (2.0)

  • 'Lock Updates' button/shortcut to prevent updating of the picked window as you move MiniSpy.
  • Buttons/shortcuts to navigate to parent window, first child windows, next/previous windows (note: these buttons will automatically lock updates to prevent the new window being immediately overridden).
  • Vertical toolbar so that all buttons are visible.
  • Manual implementation of RealWindowFromPoint() for win95 (see bug fixes (1.2) below).
  • Addition of control styles for tooltips_class32.

Bug Fixes (2.0)

  • Missing Menu (#32768), Desktop (#32769), Icon Title (#32772), tooltips_class32, Task Switcher (#32771) classnames added to filter combobox.

New Features (1.2)

  • Show the 'hittest' result returned by the window in response to a WM_NCHITTEST message

Bug Fixes (1.2)

  • Correctly pick windows contained by a group box. Thanks to Philippe Lhoste (PhiLho@GMX.net)

    Previously, MiniSpy used the method ::WindowFromPoint() to pick the window. However, as Philippe pointed out this does not always work with controls within group boxes, specifically when the controls are behind the group box in the z-order.

    To solve this I have extended the window picking to also use ::RealChildWindowFromPoint() once the initial pick is done. The documentation for this function effectively states that it ignores windows which return HTTRANSPARENT to a WM_NCHITTEST message, which group boxes do.

    This solves the problem except for nested group boxes which are ignored by ::RealChildWindowFromPoint because they too return HTTRANSPARENT.

    The docs also indicated that ::RealChildWindowFromPoint() is not supported on windows 95 which is why I have linked to it dynamically.

New Features (1.1)

  • Can use any one of its corners to pick the windows
  • Shows window properties (via EnumPropsEx)
  • Includes richedit ES_ styles
  • Includes richedit ENM_ styles
  • Includes common control CCS_ styles for toolbars and status bars
  • Provides a 'Restore Size' button to return to the startup size

Bug Fixes (1.11)

  • Crash under XP when enumerating properties using EnumPropsEx(). Thanks to limax (limax@hot.ee).

Some Comments on the Source Code

  • All the class, window, windowEx and control styles that are used are located in styles.h. If I've missed any, feel free to add them to your version and mail them to me for addition
  • I decided to make MiniSpy 'always on top' as i find it most useful in that mode, but when i turned on tooltips in the list control these appeared behind the MiniSpy Window! Since the tooltips are a very useful feature for the style rows, I came up with an interesting workaround: I handle WM_ACTIVATEAPP and make MiniSpy 'topmost' when its not the active window and 'not topmost' when it is active.
  • To retrieve the window caption for the window and its parent I've used WM_GETTEXT instead of GetWindowText. This is simply because, for one reason or another, GetWindowText did not seem to work for some windows in this situation.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

.dan.g.


.dan.g. is a former chartered structural engineer from the uk. He's been programming for 25 years since university and has been developing commercial windows software in Australia since 1998. He has a shaved head and assorted whiskers should you want to recognize him. [update] Dan has now grown his hair and removed his whiskers in an attempt to appear more normal. However he can still be recognized (in the summer months) by the aqua nail-polish he uses on his big toes. [/update]

For all his latest freeware visit http://www.abstractspoon.com/
Occupation: Software Developer (Senior)
Location: Australia Australia

Other popular Applications & Tools articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 25 of 33 (Total in Forum: 33) (Refresh)FirstPrevNext
Subject  Author Date 
QuestionASP.NETmemberpatiech23:33 12 Mar '06  
GeneralMore complex spy heresussAnonymous18:06 26 Aug '05  
GeneralGood articlemember^^o000o^^7:24 22 Nov '04  
GeneralGreat appmemberkorsuas5:00 8 Apr '04  
GeneralRe: Great appmember.dan.g.22:40 9 Apr '04  
GeneralAm I fussy?memberMykel13:49 16 Jan '04  
GeneralYAY!memberDaFrawg7:57 11 Jan '04  
GeneralRe: YAY!member.dan.g.19:22 13 Jan '04  
GeneralRequestmemberDarren Schroeder16:37 29 Jul '02  
GeneralRe: RequestmemberDanG17:53 30 Jul '02  
GeneralChild windowsmemberPhilippe Lhoste7:06 17 Jul '02  
GeneralRe: Child windowsmemberDanG19:54 18 Jul '02  
GeneralRe: Child windowsmemberPhilippe Lhoste3:43 22 Jul '02  
GeneralRe: Child windowsmemberDanG16:34 22 Jul '02  
GeneralRe: Child windowsmemberPhilippe Lhoste23:15 22 Jul '02  
General:-) ThankssubeditorBrian Delahunty6:57 19 Jun '02  
GeneralContext sensitive menumembered welch5:06 16 Apr '02  
GeneralGreat ! one question...memberShaun baradara1:25 30 Mar '02  
GeneralRe: Great ! one question...memberDanG0:57 28 Jun '02  
GeneralVery nice!memberLuis Alonso Ramos22:31 2 Feb '02  
GeneralRunning the EXE crashes under WXPmemberUwe Keim11:24 29 Jan '02  
GeneralRe: Running the EXE crashes under WXPmemberDanG13:13 29 Jan '02  
GeneralBug in PropEnumProcExmemberlimax2:32 23 Jan '02  
GeneralRe: Bug in PropEnumProcExmemberDanG12:49 23 Jan '02  
GeneralSome suggestionsmemberJames Brown8:23 21 Jan '02  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 27 Jul 2002
Editor: Chris Maunder
Copyright 2002 by .dan.g.
Everything else Copyright © CodeProject, 1999-2008
Web15 | Advertise on the Code Project