 |
|

|
Hi cplotts,
This is an amazing utility. Can you say if it is possible to evaluate the contents of TextBox controls on a form? I'd like to use this to poll for an invoice or order number on a form when a system 'HotKey' is pressed and then do some subsequent work.
Thanks,
Scott
|
|
|
|

|
Sure ... it's possible. I mean, this tool let's you actually change properties at run-time ... not just evaluate them.
|
|
|
|

|
cplotts,
Thanks for the reply.
Is wfspy not intended to return as much detail as Microsoft Spy++? If not, can you advise approach to enable?
Thanks,
Scott
|
|
|
|

|
They are entirely two different utilities. Spy++ is a utility for Win32 applications, designed to return info on the window properties, messages, etc.
wfSpy is utility for Windows Forms applications, designed to return info on Windows Forms controls, allowing you to view and change properties.
|
|
|
|

|
Hi Rama Krishna Vavilala,
I am not able to run your application. demo and code both not work in VS 2008.
How to get Window calc properties using using your application. (Like button size, color, label color, font, font size).
i have accessibility project but its not given font size, colors, etc....
Even UI Automation also give some of properties. But i need all properties. i fount one application "Test complete". But its test application product but i need only properties.
Please Help me if you know anything.
Useful link :http://msdn.microsoft.com/en-us/library/33134sx6%28v=VS.80%29.
|
|
|
|

|
In the WHSPYhook code, it i s monitoring all the messagess and hooking it. Iam not sure how to filter the specfic message for explae I have to hook only for Menu click and proceed.
Also Iam not understand that what is the function of the following code?
SetEvent(hEvent);
//Post a simple message
PostThreadMessage(threadID, WM_NULL, 0, 0);
Thanks,Mohan
|
|
|
|

|
I have tried to use the same techique (hook process )for multithreaded application which is running on Dual core processor. But it is creating some syncronization issue and with in one stacktrace multiple commands are getting executed.
It would be greatful if it getting resolved .Any thoughts?
Thanks, Mohan
|
|
|
|

|
Very, very nice. thanks!
Miguel Barros - Developer
t3k.pt
|
|
|
|

|
Hi,
I copy the source, compile/rebuild the project and then run the application. If i ask for one properties detail, close the property window, close the application, both .dll are still in use ....why? is there something missing or something to free? Is it possible to force the dll to be unloaded when closing the application or the only way is to close the application with the injected dll???
Thanks for help!
|
|
|
|

|
Do you know if this process can be used on a WindowsCE device, or are some of the C++ commands specific to the desktop?
|
|
|
|

|
Hi Rama,
Are you planning on writing the article about injecting .NET assemblies into arbitrary processes anytime soon? I'm thinking of writing an article about using wfspy to do some automated testing (with due credit to you, of couse), so if you are not going to write about it, I could explain how it works.
|
|
|
|

|
S. Senthil Kumar wrote: thinking of writing an article about using wfspy to do some automated testing
Go Ahead!
I was planning to write an article on assembly injection, but somehow I am getting enough time to do that.
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -Brian Kernighan
|
|
|
|

|
great program!
wat's the URL of the new article?
|
|
|
|

|
I'm working on a GUI automation project. For .Net apps, it would be very helpful to be able to access all of these properties programatically. I'm sure I'm missing something obvious in the code, but could anyone detail or point me at an example of how to do this?
When working with the control, I will already have determined the hWnd. Given that, I'm looking to retrieve specific property information from the control (what properties would depend on the control and what is needed). Thanks for any help pointing me in the correct direction.
|
|
|
|

|
I'm also looking for a similar feature.I'm trying to build the program so that it can monitor specific open windows and monitor a few controls in those open windows and it has to monitor both managed and unmanaged applciations. Has anyone built such a program or have any suggession on this?
Thanks
Charan
|
|
|
|

|
A Great util. thank you.
"In quiet and silence, the truth is made clear."
|
|
|
|

|
Hey ... I have added functionality to synchronize the tree view if it can find the window you are spying on ... would you like you incorporate this into the utility?
Note: the above feature only makes sense if you understand that I am using Don Kackman's (see below) improvement of a crosshairs to help the user locate the window they want to spy.
|
|
|
|
|

|
I was very disappointed with ManagedSpy. Your utility kicks butt over it. ManagedSpy needs everything to be serializable in order to even show up in the properties window.
I personally think that Windows Forms Spy is awesome and is an invaluable tool for user interface developers. I think you would have a lot more interest in this utility if you incorporate the crosshairs that Don (again below) suggested. This allows the user to quickly find the window they are looking for.
Btw, I have already converted your utility to .NET 2.0. However, the .NET 1.1 executable can spy both .NET 1.1 and .NET 2.0 applications while the .NET 2.0 wfSpy executable can only spy .NET 2.0 applications. So ... the .NET 1.1 application seems to be more useful in that regard.
Finally, several other feature requests have come to me (as a result of my championing this utility at our company). As time allows, I might slip some more of these in. Of course, I'll share the wealth with the Code Project community as I do so.
|
|
|
|

|
I'm trying to make a managedSpy that list .Net 1.1 and 2.x process/controls...
How did you convert this program to list both .net version??? is the modified version is available somewhere??
Thanks!
lsdisciples@hotmail.com
|
|
|
|

|
I have responded to you on my blog.
|
|
|
|
|

|
Still I want to use your tool. Can you please change the tool for .NET 2.1 and publish it?
Thanks,
Mohan
|
|
|
|

|
When using the tool compiled in VS2003 and trying to view application that have been compiled in VS2005 it fails to find the windows.
I've tried to compile the code in VS2005 but it fails to with the following error message.
Error 1 Command line error D8016 : '/MT' and '/clr:oldsyntax' command-line options are incompatible cl
|
|
|
|

|
Yes, In .NET 2.0 the windows forms class names are different. I will update the article. There are few other changes.
My Blog
|
|
|
|

|
Thanks for the quick response, could you please let me know when the article and source code will be available.
Thanks
|
|
|
|

|
I am also getting the same error
Error 1 Command line error D8016 : '/MT' and '/clr:oldsyntax' command-line options are incompatible cl
Also when I try to call these dlls from other project(VB.Net) ,Iam getting the following error.
"Managed Debugging Assistant 'LoaderLock' has detected a problem in 'F:\VBSource\bin\Debug\Project1.exe'.
Additional Information: DLL 'F:\VBSource\bin\Debug\spyhook.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang."
But it was working fine for VS2003.
Can you please give me the solution.
Thanks,
Mohan
|
|
|
|

|
Very impressive!!!!!!!
Super, GREAT!!!!
Flauzer!!!
|
|
|
|

|
I am really impressed with this excellent program.
One question: Is there really any problem with a different .NET version?
> The included wfspy works only for .NET windows 1.0.3705.
> If you want the tool to work with .NET 1.1, please build the code using VS.NET 2003.
I have tried it without rebuild but can't notice any problem. It is working fine.
> If you use wfspy to view a window in an application that uses a different .NET version, strange results may occur.
I have aloso tried this case but can't notice any problem.
I have used wfspy built by VS.NET 2003 to view a window in an application that was built by VS.NET 2005 beta2.
It is working fine.
Can anyone help me?
Thanks,
YamaK
|
|
|
|

|
Hello all,
I have tried to compile and run in release mode. It is not working . it is working fine only with Debug mode. I am using .Net2003.
Can any one please solve this issues?
Thanks,
Mohan
|
|
|
|

|
It's probably a linking problem. When I first converted and compiled it I had the same problem.
LINK : warning LNK4243: DLL containing objects compiled with /clr is not linked with /NOENTRY; image may not run correctly
I haven't really looked at the code yet but it looks like a dll is not linked properly so the exe will only run if it resides in the same folder as the dll.
|
|
|
|

|
is there any way I could find the handle of unmanaged window like a dialog window(this dialog window has a parent,now I want to retrieve the handle of the child window through enumarating)
I cant do it.
can anyone help me?
|
|
|
|

|
This is a really handy tool (you got my 5). I'd like to make a suggestion.
One of the best features of Spy++ is the find window tool that allow you to drag the mouse around the screen to find a particular window.
A feature like that for this tool would be nice addition. I've slapped together quick piece of code that could be a start.
After adding a picture box to the MainForm add the following code (and appropriate event handler assignments) to the MainForm class:
private bool m_HasCapture = false;
private void pictureBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if ( !m_HasCapture )
{
SetCapture(this.Handle);
m_HasCapture = true;
Cursor.Current = Cursors.Cross;
}
}
[DllImport("user32.dll")]
static extern IntPtr SetCapture( IntPtr hWnd );
[DllImport("user32.dll")]
static extern bool ReleaseCapture();
[DllImport("user32.dll")]
static extern IntPtr WindowFromPoint( Point pt );
private void pictureBox1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
if ( m_HasCapture )
{
ReleaseCapture();
m_HasCapture= false;
}
}
private void MainForm_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if ( m_HasCapture )
System.Diagnostics.Trace.WriteLine( string.Format( "{0}, {1}", Control.MousePosition.X, Control.MousePosition.Y ) );
}
private void MainForm_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
if ( m_HasCapture )
{
System.Diagnostics.Trace.WriteLine( string.Format( "{0}, {1}", Control.MousePosition.X, Control.MousePosition.Y ) );
ReleaseCapture();
m_HasCapture= false;
Point pt = new Point( Control.MousePosition.X, Control.MousePosition.Y );
IntPtr hWnd = WindowFromPoint( pt );
if ( hWnd != IntPtr.Zero && Control.FromChildHandle( hWnd ) == null )
{
WindowPropertiesForm propForm = new WindowPropertiesForm();
propForm.TargetWindowHandle = hWnd;
FormSizeSaver saver = new FormSizeSaver(propForm);
propForm.ShowDialog();
}
}
}
|
|
|
|

|
Mr.Don,
thanks for your suggestion. I have tried your suggestion. It is working fine with debug mode. For some reason, it is not working with Release mopde.
Do you have any idea or suggestion on this?
Thanks
Mohan
|
|
|
|

|
Hmmm. My version works fine in release mode.
The code I posted above was whipped togehter pretty quickly more for demonstration purposes than anything.
Send me an email ( dkackman_2000 at yahoo dot com ) and I can send you my modified version of this project.
|
|
|
|

|
It it possible for all open window ?
|
|
|
|

|
not a very smart question there... the article specifically says it works for managed windows only.
ROFLOLMFAO
|
|
|
|

|
Great Article.
How could we get the Control Name also in the detail dialog?
Thanks,
Olivier
|
|
|
|

|
I came across this rather late but to get the ControlName, all you need to do is add the following property to the WindowProperties class:
[Category("Type")]
public string ControlName
{
get
{
return targetControl.Name ;
}
}
Thanks, Neelesh
|
|
|
|

|
Hi,
I'm not really using .NET yet, but I'm following the projects that come up here on CP. When I saw this one, I immediastely wondered whether this technique could be used to allow Jabes' ControlInspector to monitor events in other processes:
http://www.codeproject.com/csharp/controlinspector.asp
What do you think?
Swythan
|
|
|
|

|
I haven't had a chance to look at this article in any depth just yet, but I wouldn't have any problem with Rama taking the event capturing code from controlinspector to integrate with this project.
If there's anything I can do to help, Rama - just send me an email!
Best wishes
James
|
|
|
|

|
Looks like it can be done. I will update the article as soon as I finish it.
I don't choose the targets - they present themselves to me in an almost garish display of submission and sacrifice. It's my duty to react as I do. - John Simmons/Outlaw Programmer
|
|
|
|

|
Got my 5
Cheers,
Stoyan
ASCII stupid question, get a stupid ANSI
|
|
|
|
|

|
Few Suggestions:
1. Right click option on the tree control (for Properties)
2. How about merging the properties window into the main window. Make the 'Legend' stuff as modeless dialog.
BTW, you got my 5.
"Whidbey"..."Orcas"...Roadmap This signature was created by "Code Project Quoter".
|
|
|
|

|
Kant wrote:
How about merging the properties window into the main window. Make the 'Legend' stuff as modeless dialog.
Well the properties window belongs to another process so each time you change selection dll has to be injected in the target process. I prefered to show it in another window to keep things simple
I don't choose the targets - they present themselves to me in an almost garish display of submission and sacrifice. It's my duty to react as I do. - John Simmons/Outlaw Programmer
|
|
|
|
|

|
Excellent! Adding it to my toolbox.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
 |