Link to home
Start Free TrialLog in
Avatar of sundeep07_er
sundeep07_er

asked on

automate a drag and drop operation

hi experts,
Pls help. I want to automate a the process of dragging a particular treeview item and drop it on another treeview control (both treeview controls are child windows of   another application running on win2000) .I

I tried by sending mouse  (WM_)mouse  messages to mimic the clicking of a treeview node and wm_lbuttonup message to the target treeview  but nothing worked.

I understand that in the other application the first treeview control is capturing the mouse when ever a mouse is held down .(found using the spy++)
But i have no idea ,as how to force a window in another application to capture the mouse and make it believe that an actual dragging operation is underway.



pls help.  
ASKER CERTIFIED SOLUTION
Avatar of masterbaker
masterbaker
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of javanic
javanic

Take a look at this knowledge base article:

http://support.microsoft.com/kb/815675

It describes dragging and dropping between two treenodes.

Your target window doesn't need to know about the mouse click on the source window. Drag and drop is an OLE function. When you start a drag operation, you are really just copying or cutting some text from one control. When you drop the dragged item in the target control, you are really just handling the text that was dragged from the source control.

Hope that helps.

javanic
Avatar of sundeep07_er

ASKER

Hi experts , Tnx for the response.I think I have not made my question clear.
I am working on a mini projet which will automate many of my daily work.

we have at our office a big application on whcih I work.Many of the work is monotonous and booring.So I wanted to automate all of the tasks,

When ever I used any automation kind of software I simulats the mouse clicks and key strokes so, here my target application must receive focus all the time when the automation software is running.
To avoid this I retreived the window handles of several text box and other windos and sent appropiate messages .With this my terget app. need not be the window having the focus.I can have it minimised and I can work on other job while my own software is doing the job of automation.

Now, the problem here is that I have to drag and drop a particular item (depending upon certain conditions) and drop it on a treeviw control.

I want to drag and drop even while the window is minimised.Just like I am able to simulate keystrokes by sending messages (even while the window is minimised) I want to perform the drag and drop operation even while the window is minimised.
I strongly believe that it can be done .but how?
Pls help.