CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2012
    Posts
    19

    Question How to click an item in listview(Win32/C++)

    Dear Experts,

    I am developing an automation tool(C++) for which I need to write program to Click,Doubleclick on the Listview item by using the Handle of the listview control and index of the item. (Win32/C++).Kindly help.
    Last edited by haroonrulz; January 2nd, 2013 at 10:04 AM.

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: How to click an item in listview(Win32/C++)

    As you know clicking an item in Listbox is very easy
    Really? As long as click is a general user input action in Windows, if you know how to click listbox, you know how to click anything else.
    Best regards,
    Igor

  3. #3
    Join Date
    Jun 2012
    Posts
    19

    Re: How to click an item in listview(Win32/C++)

    Sorry Igor, I have edited my question,kindly help.

  4. #4
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: How to click an item in listview(Win32/C++)

    Sorry pal, but I have no answers to your assignment. Clicking itself is the easiest part here. The most tricky thing is determining item rectangle in the listview window. There's no straightforward Win API to find that out, as far as I know. So good luck in your research.
    Best regards,
    Igor

  5. #5
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: How to click an item in listview(Win32/C++)

    Look at LVM_GETITEMRECT message. This returns a RECT structure containing the bounding rectangle for the specified index of the listview item. Note that using SendInput as suggested by Igor requires absolute coordinates for the mouse position for the MOUSEINPUT structure to position the mouse before issuing a click. You'll have to convert the info in the RECT structure into absolute x, y co-ordinates before using SendInput. Good luck!

  6. #6
    Join Date
    Oct 2012
    Posts
    8

    Re: How to click an item in listview(Win32/C++)

    The item may not be visible, you may need to use message ListView_EnsureVisible

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured