If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

I am developing an automation tool. I want to click listview item of another process programatically. I have partially succeeded in doing. But I am getting a slightly different output.I have used NMITEMACTIVATE(I have also used PostMessage Instead of SendMessage in the code below).

You are not allowed to send or post message which parameter passes pointers over. While valid in the context of your process, the pointer is invalid in the context of another one. Processes do not share their memory spaces. Any Win32 process memory is virtualized and isolated from others.

Igor I was expecting your reply. Thanks.
This is what I have done:
1.Wrote code to get parent handle,listview handle,listview item to click
2.shared memory to other process using -"Creating Named Shared Memory"
3.Used hooking concept
4.Inside the hook proc code,added the code which is above.
I tested with winspy++ (another process), its working fine. But while testing on other application application its not working.

I tested with winspy++ (another process), its working fine. But while testing on other application application its not working.

What with winspy is working fine? What is not working with your hook? Are you sure your hook gets activated in the remote process? Do you fully understand what WM_NOTIFY is and what it's used for?

You should build some simplistic app including list view, and there you fully implement the automation behavior you want, and make sure it works in local process. Only then you put your code into hook dll and try it with remote process.

Testing Winspy:
Manually first I tested winspy, by clicking on the second listview item in winspy the listview gets blank.
So I run my code,then the Listview in winspy became blank.So I confirmed that my Hook code is working properly for remote process. Pic (1.1.jpg)

Simple Listview Application:
Then I tested in another application (1.2.jpg), nothing happened.So I downloaded the source code of this application, then I came to know that my code is not getting detected.

1.If my Hook code is not working,It would not been worked in winspy++ also ?

As for your code. It seems you never noticed my question if you really understand what WM_NOTIFY is.

Let's see what happens when you do a hardware click. The control window receives WM_LBUTTONDOWN and does its internal processing like changing item selection, modifying internal data structures about control state, doing proper drawing, etc. There's a lot of important things it does prior to sending WM_NOTIFY to control's parent. On the notification the parent does its own part like getting information from notification, possibly getting other information from control's internal data structures, and finally decides what to do next. Like showing message box.

Now about what your code does. It just makes parent believe the click was done without a real click and all the related internal control's processing. Parent is told that control has changed, but nothing has changed. No surprise it all works not the way you expected.

As my ultimate target is to automate MFC based application.I downloaded application/Source code from here : http://www.codeproject.com/Articles/...e-List-Control . As per you Suggestion I debugged the source code, its working good.(my Hook gets activated in another process and SendMessage working good).Thanks for explaining WM_NOTIFY , I do understand it.
But my program is not working in the application which in which I need to automate. You can see from the picture that the Expected(fig1) and Actual(fig2) are different.Some number is getting displayed before OK,Cancel. If you know any useful link,please let me know.Also let me know if I am doing any mistake in constructing structure below,

You are not allowed to send or post message which parameter passes pointers over. While valid in the context of your process, the pointer is invalid in the context of another one. Processes do not share their memory spaces. Any Win32 process memory is virtualized and isolated from others.

To read/write memory of another process you use the ReadProcessMemory and WriteProcessMemory API functions.

If you really did, the first thing you would do is stopping sending it. While you still do send it, to some reason beyond my understanding.

You had a plan, and you were told that the plan is of no use. A really logical thing would be to get back and re-think the whole idea. Did you ever hear of mouse_event or SendInput?

But my program is not working in the application which in which I need to automate. You can see from the picture that the Expected(fig1) and Actual(fig2) are different.Some number is getting displayed before OK,Cancel. If you know any useful link,please let me know.Also let me know if I am doing any mistake in constructing structure below,

Okay, it seems we're going in circles. The snippet you post here over and over must have nothing to do with the numbers, and the root cause is somewhere else, in your code or not, I don't know. Do you really expect anybody would understand the problem having just a description like this, a couple of weird screenshots and a trivial code snippet that makes no sense, especially in the context of your automation story? I tell you again that sending WM_NOTIFY itself is a mistake. If you need a click, you send a click, but not a fake notification about something that never happened.

And the last thing. Sending WM_NOTIFY is a privilege of common controls. Your code never should do that.

This is the whole story>
user has testcase --> writes the script according to my program --> executes the script --> the script simulates the application.similar to QTP

Did you ever hear of mouse_event or SendInput?

Yes, I know about these.But I could not use this as user may use this script in different system which has different resolution. This is not generic. If you had worked in QTP this is called "Analog Recording" record and playback.

but not a fake notification about something that never happened.

Yes, I am sending fake notification that I had made a click to target application <-- This is generic. If the user uses this script he can run in any system. If you had worked in QTP this is called "Context-sensitive" record and playback.

I am trying to build a tool which is context-sensitive based and not Analog Based (Mouse_event/sendInput).
Thanks for being patient and replying to each of my question.

Yes, I know about these.But I could not use this as user may use this script in different system which has different resolution. This is not generic.

It is absolutely generic. Your user has to write script thinking not in absolute screen positions (that may depend on screen resolution) but having in mind some more generic approach. Like list items and subitems. Your hook dll code then queries the list control for the rectangle to click in (LVM_GETITEMRECT, LVM_GETSUBITEMRECT), and simulates the click with SendInput positioned inside the rect.

BTW, did you notice the post #8? In fact Arjay gave you another hint on a way to go.

Yes, I am sending fake notification that I had made a click to target application <-- This is generic.

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.