Click here to Skip to main content
Click here to Skip to main content

Yet Another Spy

, 28 Dec 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
Find a window on the desktop, spy its properties and manipulate it.

 

Introduction

MySpy enumerates windows on the desktop and lists them in a tree. You can see some properties of a window represented by a node in the tree: Title (window text), Class name, PID, HWND or the path of the Module. And more in the info pane. For example the properties of the main window of MySpy:

Title          : MySpy
HWND           : 01051258
Class Name     : MySpy_MainFrame
Class Style    : CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS
Module Name    : N/A
Rect           : (365, 167)-(1309, 695) 944x528
Window Style   : WS_BORDER | ... | WS_TILEDWINDOW | WS_VISIBLE = 349110272
Window ExStyle : WS_EX_OVERLAPPEDWINDOW |...| WS_EX_WINDOWEDGE = 00000264
Process ID     : 00000644
Thread ID      : 00006988
Window ID      : 1351813779

The flags are decoded, so you can copy the constants directly into your code.

Main toolbar: filter windows and choose display mode

The main toolbar contains the following buttons:

The functions left to right:

  • Set MySpy topmost
  • Refresh window tree
  • Filter buttons (filters can be used combined eg. visible & parent windows)
    • visible windows
    • invisible windows
    • parent windows
    • child windows
  • Display numbers in hex
  • Highlight selected window
  • Find

Find window by text or by mouse

To find a window in the tree is possible by text or by mouse also. The text can contain any part of informations displayed on a node: Title, Class, PID, HWND or the path of the Module. This tool is very handy if you want to find a control, which is hidden, or if its size became 0 for some reason. 

If you can see the window on the desktop, but you can't find it in the tree, you can choose the "By Mouse" tab. While draging the cross-hairs over a window it will be immediatelly selected in the tree, by releasing the mouse button, MySpy will be activated and the last found window will be selected in the tree.

Action toolbar

The user can take several actions on a selected window:

  • Show
  • Hide
  • Enable
  • Disable
  • Left click
  • Right click
  • Left double-click
  • Right double-click
  • Minimize
  • Maximize
  • Close

Advanced actions

This part of the program can break and cause the manipulated program to malfunction, please use it only if you know exactly what you do!

With the advanced actions toolbar you can send or post messages, set text and transparency of the selected window. The message id can be selected by the combobox or can be given also as a number.

Background

I wrote this program long time ago, but it can be used nowadays too. It helped me to detect bugs, develop tricky controls and impress colleagues they don't even know about WinApi Smile | :)

Points of Interest

WinApi is an "old" technology, but it's worth to know about it.

History

01/01/2015 3.0  Some more information, warning and document formatting
29/12/2014 2.0 Source and exe links are corrected.
29/12/2014 1.0 Initial version.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

I'm software developer & scrum master with several years of experience in project and line management.
Follow on   LinkedIn

Comments and Discussions

 
GeneralMy vote of 5 Pinmemberqiuqianren2-Jan-15 22:02 
QuestionRe: My vote of 5 PinmemberAkos Mattiassich4-Jan-15 6:10 
BugRe: My vote of 5 Pinmemberqiuqianren6-Jan-15 6:39 
GeneralRe: My vote of 5 PinmemberAkos Mattiassich6-Jan-15 9:51 
GeneralRe: My vote of 5 PinmemberAkos Mattiassich6-Jan-15 10:03 
GeneralRe: My vote of 5 Pinmemberqiuqianren6-Jan-15 19:31 
GeneralMy vote of 5 Pinmemberskyformat99@gmail.com29-Dec-14 21:48 
QuestionSource Code Missing PinprofessionalEd Gadziemski29-Dec-14 11:39 
AnswerRe: Source Code Missing PinmemberAkos Mattiassich29-Dec-14 11:46 
QuestionSource And Demo Files Missing PinmemberMasterCodeon29-Dec-14 9:49 
AnswerRe: Source And Demo Files Missing PinmemberAkos Mattiassich29-Dec-14 10:07 
GeneralRe: Source And Demo Files Missing PinmemberMasterCodeon29-Dec-14 11:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150129.1 | Last Updated 29 Dec 2014
Article Copyright 2014 by Akos Mattiassich
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid