Automationuser Posted June 28, 2013 Share Posted June 28, 2013 Hi Everyone, I have an window's application which is built on C++. I want to automate double click on a subitem in a listview and enter data. I have gone through _GUICtrlListView_ClickItem() function, but this doesn't allow to click on a subitem. how can this be done?? Please help. Link to comment Share on other sites More sharing options...
Automationuser Posted July 1, 2013 Author Share Posted July 1, 2013 Hell All, Can someone help me on this? I tried a lot, but still not able to get the solution Link to comment Share on other sites More sharing options...
TheSaint Posted July 1, 2013 Share Posted July 1, 2013 As always, we help those who help themselves. That means, that you need to present us with the code you've used so far, so that we can detect any errors you may have made and so that we don't have to code something from scratch for you. Saves time all around, especially for us volunteers. P.S. All except trancexx, who is a special case and doesn't want to be classed as 'we' or 'us' or even a volunteer (especially one that doesn't like getting unsolicited PM's). Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
water Posted July 1, 2013 Share Posted July 1, 2013 To automate the listview of another application function ControlGetHandle seems to be a good starting point. But, as The Saint already said, post what you have already tried and we will see how we can help. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Automationuser Posted July 1, 2013 Author Share Posted July 1, 2013 $HWD=controlgethandle("TestApp","","[CLASS:SysListView32; INSTANCE:1]") _GUICtrlListView_ClickItem($HWD,0," "," ",2) I want to double click on the subitem of the index 0 Link to comment Share on other sites More sharing options...
Automationuser Posted December 9, 2013 Author Share Posted December 9, 2013 Hi Guys, Can anyone help me with this. Still I am not able to double click on the second column in a list view Link to comment Share on other sites More sharing options...
mikell Posted December 9, 2013 Share Posted December 9, 2013 If you use the dbleclick optional parameter then you must define the preceding ones Did you try _GUICtrlListView_ClickItem($HWD, 0, "left", False, 2) Link to comment Share on other sites More sharing options...
Automationuser Posted December 10, 2013 Author Share Posted December 10, 2013 @Mikell, I want to double click on the subitem. _GUICtrlListView_ClickItem() doesn't have subitem parameter. Link to comment Share on other sites More sharing options...
mikell Posted December 10, 2013 Share Posted December 10, 2013 (edited) Here is a scent But... I've got absolutely no idea of how this can work or not on an external listview (not tested) expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> $gui = GUICreate("", 300, 450) Local $listView = GUICtrlCreateListView("A|B|C|D|E|F|G", 20, 20, 250, 350, -1, $LVS_EX_GRIDLINES) For $i = 0 To 20 GUICtrlCreateListViewItem("A" & $i & "|B" & $i & "|C" & $i & "|D" & $i & "|E" & $i & "|F" & $i & "|G" & $i, $listView) Next $listView = GUICtrlGetHandle($listView) ;the example didn't work when used with ControlID. $label1 = GuiCtrlCreateLabel("item", 50, 380, 50, 17) $input1 = GuiCtrlCreateInput("1", 100, 380, 30, 17) $label2 = GuiCtrlCreateLabel("subitem", 50, 400, 50, 17) $input2 = GuiCtrlCreateInput("1", 100, 400, 30, 17) $btn = GuiCtrlCreateButton("click", 150, 390, 50, 25) GUISetState() Do $nMsg = GUIGetMsg() Switch $nMsg Case $btn $it = GuiCtrlRead($input1)+1 $subit = GuiCtrlRead($input2) $aRect = _GUICtrlListView_GetSubItemRect($listView, $it, $subit) $iX = ($aRect[0]+$aRect[2])/2 $iY = ($aRect[1]+$aRect[3])/2 _GUICtrlListView_EnsureVisible($listView, 2, True) Local $iMode = Opt("MouseCoordMode", 2) Local $aPos = MouseGetPos() _WinAPI_ShowCursor(False) MouseClick("left", $iX, $iY, 2, 1) $sSubitem = GetItemClicked($listView) ; <<<< this is for the test MouseMove($aPos[0], $aPos[1], 0) _WinAPI_ShowCursor(True) Opt("MouseCoordMode", $iMode) If $sSubitem <>"" Then Msgbox(0,"", $sSubitem & ": was clicked") ; <<<< this too EndSwitch Until $nMsg = $GUI_EVENT_CLOSE Func GetItemClicked( $hListView ) $aInfo = _GUICtrlListView_SubItemHitTest( $hlistView ) If $aInfo[0] = -1 Or $aInfo[1] = -1 Then Return SetError(2, 0, -1) If IsArray($aInfo) = 0 Then Return SetError(1, 0, -1) ;get the item/subitem text. Return _GUICtrlListView_GetItemText($hlistView, $aInfo[0], $aInfo[1]) EndFunc Edited December 10, 2013 by mikell Link to comment Share on other sites More sharing options...
Automationuser Posted December 11, 2013 Author Share Posted December 11, 2013 Thanks Mikell, This doesn't work on external application Is there any other way. to do this?? Or _GUICtrlListView_ClickItem() should be modified to include subitem? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now