|
|
How about a flash window toolbar button?
|
|
|
|
|
good idea.
also might be useful to flash windows as they are picked.
|
|
|
|
|
MiniSpy only looks at the first window found under the cursor.
For example, if a control is inside a group box (a quite common case...) and this group box is first in the Windows handle list, MiniSpy shows the group box but none of the controls inside.
You can take a look at Multimedia Properties, Audio tab, Playback group box so see this.
This is annoying...
I am looking a way to dig inside, but currently I have no luck using ChildWindowFromPoint.
[Some time later]
Well, the method I found is to enumerate the sibblings of the found window until I find the one I search for. In my case, the checkbox or radiobutton which have the cursor inside its rectangle. But we can search the smallest sibbling including the cursor, for example. Except for childs and group boxes, overlapping windows are quite rare.
One case can be with long labels overlapping the associated control, though.
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
|
|
|
|
|
Previously, MiniSpy used the method ::WindowFromPoint() to pick the window. However, as you have 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 indicate that ::RealChildWindowFromPoint() is not supported on windows 95 which is why I have linked to it dynamically.
I have sent updated source/exe to chris maunder and this will appear presently.
|
|
|
|
|
Good reactivity
I was/am reluctant to use the RealChildWindowFromPoint function, since it doesn't work on Win95, but at least it seems to work fine (on NT).
Good work. Thank you.
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
|
|
|
|
|
>> it doesn't work on Win95
i suspect that it would not be too difficult to implement this method manually.
1. walk all the children in the parent of the wnd returned from WindowFromPoint().
2. for each child, send WM_NCHITTEST and return the first child which returns something other than HTTRANSPARENT or HTNOWHERE.
regards
|
|
|
|
|
Thank you for the pointer, I will try it out.
I had to refresh my memory about this WM_NCHITTEST message, it seems quite useful
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
|
|
|
|
|
Cool
"When a friend hurts us, we should write it down in the sand, where the winds of forgiveness get in charge of erasing it away, and when something great happens, we should engrave it in the stone of the memory of the heart, where no wind can erase it" Nish on life [methinks]
"It's The Soapbox; topics are optional" Shog 9
|
|
|
|
|
Hi,
Excellent tool! Well done!
I wanted to use it to allow the text in read-only error messages to be copied to the clipboard. I enabled this by adding a right click menu to copy the currently selected item to the clipboard – then you can copy the Caption text.
In case anyone else finds this useful here is the code:
Add the menu resource to the RC file:
IDR_GRID_CONTEXT MENU DISCARDABLE
BEGIN
POPUP "context"
BEGIN
MENUITEM "©", ID_COPY
END
END
Add these lines to MiniSpyDlg.h
afx_msg void OnRclickAttributes(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnCopy();
Add these to the message map in MiniSpyDlg.cpp:
ON_NOTIFY(NM_RCLICK, IDC_ATTRIBUTES, OnRclickAttributes)
ON_COMMAND(ID_COPY, OnCopy)
Finally add these functions:
void CMiniSpyDlg::OnRclickAttributes(NMHDR*, LRESULT* pResult)
{
POINT pointScreen;
DWORD dwPos;
dwPos = GetMessagePos();
pointScreen.x = LOWORD(dwPos);
pointScreen.y = HIWORD(dwPos);
// Convert the point from screen to client coordinates,
// relative to the listview
CMenu* pMenu = m_menu.GetSubMenu(0);
pMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, pointScreen.x, pointScreen.y, this);
*pResult = 0;
}
void CMiniSpyDlg::OnCopy()
{
CString str;
POSITION pos = m_lcAttributes.GetFirstSelectedItemPosition();
if (pos == NULL) return;
int nItem = m_lcAttributes.GetNextSelectedItem(pos);
str = m_lcAttributes.GetItemText(nItem, 1);
if (str.GetLength() == 0) return;
if ( OpenClipboard() )
{
EmptyClipboard();
CSharedFile sfText(GMEM_MOVEABLE|GMEM_DDESHARE|GMEM_ZEROINIT);
HGLOBAL hData = 0;
sfText.Write(str, str.GetLength());
hData = sfText.Detach();
if (hData)
{
SetClipboardData(CF_TEXT, hData);
}
CloseClipboard();
}
}
|
|
|
|
|
is it possible to use a toolbar in a dialog if so would you please let me know how to.
thaanks in advance.
|
|
|
|
|
sorry for the immense delay
the key is in handling the TTN_NEEDTEXT notification manually.
check out the following handler:
BOOL CMiniSpyDlg::OnNeedTooltip(UINT, NMHDR* pNMHDR, LRESULT* pResult)
|
|
|
|
|
Hi,
MiniSpy it's cool!! I'd suggest for 2.0 a better display of window properties, inside a combo box for example, so that you can see all without scrolling... Also how about some window navigation? (like going to parent, first child or sibling. I think someone mentioned this already)
Cheers,
-- LuisR
--------
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
|
|
|
|
|
When I run the EXE directly from the download (no compiling myself), it crashes before doing/showing anything at all.
I'm using WXP Professional, German version, latest ServicePack and Hotfix stuff.
--
See me: www.magerquark.de
|
|
|
|
|
i have posted a fix for this (see the mail thread regarding PropEnumProcEx) but i guess it has not yet been updated.
|
|
|
|
|
MiniSpy may crash at any moment. OS: WindowsXP.
After debugging I realized that some calls to CMiniSpyDlg::PropEnumProcEx in file MiniSpyDlg.cpp have strange LPTSTR lpszString parameter value. For example 0x0000a918, and of course it is wrong pointer value. This value is set by SetProp() function and here is it's description:
lpString <br />
Pointer to a null-terminated string or contains an atom that identifies a string. If this parameter is an atom, it must be a global atom created by a previous call to theGlobalAddAtom function. The atom, a 16-bit value, must be placed in the low-order word of lpString; the high-order word must be zero.
So you should check if it is string or atom.
Here is code to do that:
BOOL CALLBACK CMiniSpyDlg::PropEnumProcEx(HWND , LPTSTR lpszString, HANDLE hData, DWORD dwData)
{
TCHAR szAtomName[6+256]=_T("Atom: ");
if (lpszString == (LPTSTR)(ATOM)lpszString)
{
GlobalGetAtomName((ATOM)lpszString,&szAtomName[6],256);
lpszString = szAtomName;
}
}
|
|
|
|
|
thanks very much for this.
i have changed the code, verified it under XP and submitted an update package.
i guess it will take a couple of days to appear here.
|
|
|
|
|
Hi,
Just a couple of suggestions really.
Firstly, I think you've forgotten to update the executable download to reflect the new version.
With regard to your tooltip and "always on top" problem - In an application I wrote, I solved this by responding to the TTN_SHOW notification that a tooltip sends to it's parent, and making the tool-tip topmost when necessary. This seemed to be a nice solution, but it's just something for you to bear in mind.
Just a point about your article text also: you say that Spy++ does not display control-specific styles for list-boxes, common controls etc. Well, the version that ships with MSVC 6.0 seems to, so maybe you used an older version?
Good work!
James
|
|
|
|
|
your tooltip solution seems like an excellent idea.
i'll give it a go.
thanks
ps and you're quite correct about spy giving the control styles too. ;(
|
|
|
|
|
A very interesting aplication to find out what other programmers do in their windows interfaces.
You might have captured the mouse to select the windows objects.
Good job.
Carlos.
|
|
|
|
|
Could you also list window's properties (EnumProps)?
- Goran.
|
|
|
|
|
|
This is great, from a quick test.
But the method used (displaying data under the top-left corner) is unintuitive and very annoying if you are trying to analyze a control on the bottom-right side of the screen...
Perhaps you should provide an alternate method to pick a window.
CopyText (http://www10.pair.com/vsap/FreeSoft.html), a similar program, picks the control under the cursor when we hit the shortcut to the program. And it provides a crude, but usable way to navigate among childs, siblings and parents.
Regards.
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
|
|
|
|
|
I agree totally.
I will have a look at the CopyText example you mentioned and see what I can come up with.
thanks
|
|
|
|
|
It will be an example by use, because source is alas not available, but it is still a valuable tool I often use.
Your can be a good concurrent though...
Suggestion (beside the "take window under cursor when starting" behavior): allow using any of the four corners as hot point, with a visual reminder of which one is active. Perhaps with a four-button matrix, one being down, or with a button on each corner, or just some color and a button to rotate the active corner, or a symbol or the rotating button, etc.
Regards.
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
|
|
|
|