Solved

automate a drag and drop operation

Posted on 2004-10-25
333 Views
Last Modified: 2010-04-17
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.  
0
Question by:sundeep07_er
    4 Comments
     
    LVL 13

    Accepted Solution

    by:
    Have you ever heard of a program called AutoIT?  Here's a link:

    http://www.autoitscript.com/autoit3/

    It is a great freeware scripting tool.  Yes, it can do mouse movements and clicks too (I assume this includes dragging and dropping).

    Jeff
    0
     
    LVL 1

    Expert Comment

    by: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
    0
     

    Author Comment

    by:sundeep07_er
    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.





    0
     
    LVL 1

    Expert Comment

    by:javanic
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    Title # Comments Views Activity
    Best way to convert ePub file to doc or docx file 11 69
    gHappy challenge 67 81
    Problem to refer to cell 8 58
    find a node in VST 2 24
    Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
    This article will show, step by step, how to integrate R code into a R Sweave document
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    913 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now