pootie tang Posted July 21, 2006 Share Posted July 21, 2006 (edited) Working DLL Please note that credit for this solution should be given to Fur.Thanks to a friend that knows VC++ much better than I, we created a mostly working DLL. I have not had any crashes or errors generated, but the CopyTreeViewToClipboard function does not seem to work. I don't need that function for the project I'm working on now so I'll look into it at a future date.I did a minor correction in the wrappers and I added an additional compound wrapper to select item by name.I have only tested on WinXP and have not yet tested all the functions. Your mileage may vary. I do not suggest all of it will work on any system or any of it will work on all systems.Included for your download:AutoItTreeViewExtension.dllTreeView Testing.au3 (includes the wrappers)TreeView_app.au3 (Provided by Zedna in an earlier post)I tried the example, it worked great. Thanks. I was going to use this to navigate though a standard "Browse For Folder" dialog from another application. If I call GetTreeViewItemByName for "Desktop' and 'My Documents' I get valid return values. If I try to get one for 'My Computer' I get an error back from Autoit!>AutoIT3.exe ended.rc:-1073741819Do you know what that might be. Thanks in advanceDave Edited July 21, 2006 by bigdaddy Link to comment Share on other sites More sharing options...
tweast Posted August 14, 2006 Share Posted August 14, 2006 Here's the source code set as that was used to compile the DLL. There were only minor changes made to the original code that I downloaded from earlier in this subject thread.Toddtweast GREAT!Can you post here C++ source of this DLL? Thanks.Look here for my post about possibility of converting this from C++ to AU3AutoItTreeViewExtension_Project.zip Link to comment Share on other sites More sharing options...
Zedna Posted August 14, 2006 Share Posted August 14, 2006 Here's the source code set as that was used to compile the DLL. There were only minor changes made to the original code that I downloaded from earlier in this subject thread. Todd tweast many thanks!! I'm using your DLL in my work projects and it's really good. Thanks also for posting sources here I found only one little mistake: Func GetSelectedTreeViewItem($hwnd, $hitem)oÝ÷ ÚÈhºW[y«¢+ÙÕ¹ÑM±ÑQÉY¥Ý%Ñ´ ÀÌØí¡Ý¹¤ Workaround is to pass always 0 in unnecessary parameter $hitem (or change AU3 wrapper for it). Dll can be renamed to what you want, I renamed it to TreeViewExtension.dll (from AutoItTreeViewExtension.dll), because that Dll can be used like universal Dll not only from AutoIt but also from another program languages. And I created AU3 wrapper TreeViewExtension.au3: my slightly corrected wrapper for this Dll derived from your original TreeView_Testing.au3: TreeViewExtension.au3 see my post in support forum about it Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
sunriser Posted September 1, 2006 Share Posted September 1, 2006 Here's the source code set as that was used to compile the DLL. There were only minor changes made to the original code that I downloaded from earlier in this subject thread.ToddI try in my application and the function get the correct treeview handle , but the $root = 0 ? then the script can not work, and when I try the attachment sample test scirpt in this post , everything is perfect.THe key problem is the dll function "TreeViewGetRoot" return 0 while I apply the script to my applicaiton, and return the correct number while apply the script to the sample applicaiton.Where it should be update? Link to comment Share on other sites More sharing options...
JeffHarris Posted September 7, 2006 Share Posted September 7, 2006 I try in my application and the function get the correct treeview handle , but the $root = 0 ? then the script can not work, and when I try the attachment sample test scirpt in this post , everything is perfect. THe key problem is the dll function "TreeViewGetRoot" return 0 while I apply the script to my applicaiton, and return the correct number while apply the script to the sample applicaiton. Where it should be update? Hi, guys. I'm running into the exact same issue. expandcollapse popup#include "GuiConstants.au3" AutoItSetOption ( "WinTitleMatchMode", 2 ) $g_socdll = DllOpen("TreeViewExtension.dll") ;==================================================== ; application window is already open, homing on the TreeView control... ;==================================================== $title = "Open Project Wizard" Local $tree = GetActiveControl($title) Local $root = TreeViewGetRoot($tree) MsgBox (4096,"Debug test script", "Tree/Root is " & $tree & " " & $root) ;=============================================== ; MsgBox display: ; ; TreeView Root Control is 0 ; ; Followed immediately by the AutoIt Error message: ; ; Line 0 ( file....) ; ; Return $foo[0] ; REturn $foo^ERROR ; ; Error: Subscript used with non-Array variable. ;=============================================== Exit ;=============================================== ; U S E R D E F I N E D F U N C T I O N S ;=============================================== ; return the hwnd for the active control in the given window Func GetActiveControl($title) WinActivate($title) return ControlGetHandle($title, "", ControlGetFocus($title)) Endfunc Func TreeViewGetRoot($hwnd) Local $foo = DllCall($g_socdll, "long", "TreeViewGetRoot", "hwnd", $hwnd) If @error Then MsgBox(0, "Debug test script", "Error with DllCall(TreeViewGetRoot)") Endif Return $foo[0] Endfunc Has anyone got an answer for this? For that matter, why is the TreeView control such a pain? Thanx! Jeff Link to comment Share on other sites More sharing options...
Zedna Posted September 7, 2006 Share Posted September 7, 2006 (edited) Hi, guys. I'm running into the exact same issue. expandcollapse popup#include "GuiConstants.au3" AutoItSetOption ( "WinTitleMatchMode", 2 ) $g_socdll = DllOpen("TreeViewExtension.dll") ;==================================================== ; application window is already open, homing on the TreeView control... ;==================================================== $title = "Open Project Wizard" Local $tree = GetActiveControl($title) Local $root = TreeViewGetRoot($tree) MsgBox (4096,"Debug test script", "Tree/Root is " & $tree & " " & $root) ;=============================================== ; MsgBox display: ; ; TreeView Root Control is 0 ; ; Followed immediately by the AutoIt Error message: ; ; Line 0 ( file....) ; ; Return $foo[0] ; REturn $foo^ERROR ; ; Error: Subscript used with non-Array variable. ;=============================================== Exit ;=============================================== ; U S E R D E F I N E D F U N C T I O N S ;=============================================== ; return the hwnd for the active control in the given window Func GetActiveControl($title) WinActivate($title) return ControlGetHandle($title, "", ControlGetFocus($title)) Endfunc Func TreeViewGetRoot($hwnd) Local $foo = DllCall($g_socdll, "long", "TreeViewGetRoot", "hwnd", $hwnd) If @error Then MsgBox(0, "Debug test script", "Error with DllCall(TreeViewGetRoot)") Endif Return $foo[0] Endfunc Has anyone got an answer for this? For that matter, why is the TreeView control such a pain? Thanx! Jeff By me your problem is in get correct treeview handle. I'm using: $tree = ControlGetHandle('Title','Text', 'SysTreeView321') $node_root = TreeViewGetRoot($tree) oÝ÷ Ù.¬Ê-¯'Q´¶¬´J뢳²Æ y§íz°å&¥Ú,yì!jÙ"Ú¦ºé¢²)⵫¢+ÙÕ¹}Ñ1ÍÑÉɽÉ5ÍÍ ÀÌØí¥ÍÁ±å5Í ½àôÅÕ½ÐìÅÕ½Ðì¤(1½°ÀÌØíÉаÀÌØíÌ(1½°ÀÌØíÀô±±MÑÉÕÑ ÉÑ ÅÕ½Ðí¡ÉlÐÀäÙtÅÕ½Ðì¤(1½° ½¹ÍÐÀÌØí=I5Q}5MM}I=5}MeMQ4ôÁàÀÀÀÀÄÀÀÀ((%ÉɽÈQ¡¸IÑÕɸÅÕ½ÐìÅÕ½Ðì((ÀÌØíÉÐô±± ±° ÅÕ½Ðí-ɹ°Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíÑ1ÍÑÉɽÈÅÕ½Ðì¤((ÀÌØíÉÐô±± ±° ÅÕ½Ðíɹ°Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½Ðí½ÉµÑ5ÍÍÅÕ½Ðì±|(ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØí=I5Q}5MM}I=5}MeMQ4±|(ÅÕ½ÐíÁÑÈÅÕ½Ðì°À±|(ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØíÉÑlÁt±|(ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À±|(ÅÕ½ÐíÁÑÈÅÕ½Ðì±±±MÑÉÕÑÑAÑÈ ÀÌØíÀ¤±|(ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÐÀäر|(ÅÕ½ÐíÁÑÈÅÕ½Ðì°À¤(ÀÌØíÌô±±MÑÉÕÑÑÑ ÀÌØíÀ°Ä¤(ÀÌØíÀôÀ((%ÀÌØí¥ÍÁ±å5Í ½à±ÐìÐìÅÕ½ÐìÅÕ½ÐìQ¡¸5Í ½à À°ÅÕ½Ðí}Ñ1ÍÑÉɽÉ5ÍÍÅÕ½Ðì°ÀÌØí¥ÍÁ±å5Í ½àµÀì I1µÀìÀÌØí̤(ÉÑÕɸÀÌØíÌ)¹Õ¹( Edited September 7, 2006 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
sunriser Posted September 8, 2006 Share Posted September 8, 2006 Sorry I didn't see your post days ago Loulou - been very busy.Here I'll just post it. Remember all the credit goes to Fur.It works great on Windows 2000 and XP. Trying to figure out why it won't return item text on 98 or Millenium. I haven't been able to try it on NT.Can you add the .dll file as the attachment or send me? I am interesting too, my email is wuwan@yahoo.comthanks in advance Link to comment Share on other sites More sharing options...
sunriser Posted September 8, 2006 Share Posted September 8, 2006 The select tree does work fine, but how can i select things in a listview?I am trying to make a script wich enables alot of policy settings.I described my situatie at: http://www.autoitscript.com/forum/index.ph...c=27426&hl=Is there a way to do this?I have the similar situation and need to go through listview and is possible someone post some .dll file about the topic.Another issues is how to make the right click on the selected item of the tree view ? controlclick does not work and it send the click to the root of the tree instead of the selected item. Link to comment Share on other sites More sharing options...
Zedna Posted September 8, 2006 Share Posted September 8, 2006 I have the similar situation and need to go through listview and is possible someone post some .dll file about the topic.Another issues is how to make the right click on the selected item of the tree view ? controlclick does not work and it send the click to the root of the tree instead of the selected item.1) For ListView use ControlListView()2) Try SelectTreeViewItem($tree, $node) first and then ControlClick() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
JeffHarris Posted September 8, 2006 Share Posted September 8, 2006 By me your problem is in get correct treeview handle. I'm using: $tree = ControlGetHandle('Title','Text', 'SysTreeView321') $node_root = TreeViewGetRoot($tree) oÝ÷ Ù.¬Ê-¯'Q´¶¬´J뢳²Æ y§íz°å&¥Ú,yì!jÙ"Ú¦ºé¢²)⵫¢+ÙÕ¹}Ñ1ÍÑÉɽÉ5ÍÍ ÀÌØí¥ÍÁ±å5Í ½àôÅÕ½ÐìÅÕ½Ðì¤(1½°ÀÌØíÉаÀÌØíÌ(1½°ÀÌØíÀô±±MÑÉÕÑ ÉÑ ÅÕ½Ðí¡ÉlÐÀäÙtÅÕ½Ðì¤(1½° ½¹ÍÐÀÌØí=I5Q}5MM}I=5}MeMQ4ôÁàÀÀÀÀÄÀÀÀ((%ÉɽÈQ¡¸IÑÕɸÅÕ½ÐìÅÕ½Ðì((ÀÌØíÉÐô±± ±° ÅÕ½Ðí-ɹ°Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíÑ1ÍÑÉɽÈÅÕ½Ðì¤((ÀÌØíÉÐô±± ±° ÅÕ½Ðíɹ°Ìȹ±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½Ðí½ÉµÑ5ÍÍÅÕ½Ðì±|(ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØí=I5Q}5MM}I=5}MeMQ4±|(ÅÕ½ÐíÁÑÈÅÕ½Ðì°À±|(ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØíÉÑlÁt±|(ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À±|(ÅÕ½ÐíÁÑÈÅÕ½Ðì±±±MÑÉÕÑÑAÑÈ ÀÌØíÀ¤±|(ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÐÀäر|(ÅÕ½ÐíÁÑÈÅÕ½Ðì°À¤(ÀÌØíÌô±±MÑÉÕÑÑÑ ÀÌØíÀ°Ä¤(ÀÌØíÀôÀ((%ÀÌØí¥ÍÁ±å5Í ½à±ÐìÐìÅÕ½ÐìÅÕ½ÐìQ¡¸5Í ½à À°ÅÕ½Ðí}Ñ1ÍÑÉɽÉ5ÍÍÅÕ½Ðì°ÀÌØí¥ÍÁ±å5Í ½àµÀì I1µÀìÀÌØí̤(ÉÑÕɸÀÌØíÌ)¹Õ¹( Well, I made the following substitution: $tree = ControlGetHandle('Open Project Wizard', 'Welcome to the Open Project Wizard', 'SysTreeView321') $node_root = TreeViewGetRoot($tree) No luck -- I still get the "TreeView Root Control Handle is 0" message, followed by... Line 0 (file...) Return $foo[0] Return $foo^ERROR Error: Subscript used with non-Array variable. When I insert the _GetLastErrorMessage code into the stream, it compiles but won't execute, giving me this: Line 0 (file....) Local $p = DllStructCreate("char[4096]") Local $p = ^ERROR Error: Unknown function name. The way I see it, I'm either missing a dll or I need to specify something with a #include statement. Seeing an example of its usage would probably be a good idea, too (I'm not the sharpest tool in the box...). Thanx for the info though, it was definitely worth a shot. Jeff Link to comment Share on other sites More sharing options...
GaryFrost Posted September 8, 2006 Share Posted September 8, 2006 Well, I made the following substitution: $tree = ControlGetHandle('Open Project Wizard', 'Welcome to the Open Project Wizard', 'SysTreeView321') $node_root = TreeViewGetRoot($tree) No luck -- I still get the "TreeView Root Control Handle is 0" message, followed by... Line 0 (file...) Return $foo[0] Return $foo^ERROR Error: Subscript used with non-Array variable. When I insert the _GetLastErrorMessage code into the stream, it compiles but won't execute, giving me this: Line 0 (file....) Local $p = DllStructCreate("char[4096]") Local $p = ^ERROR Error: Unknown function name. The way I see it, I'm either missing a dll or I need to specify something with a #include statement. Seeing an example of its usage would probably be a good idea, too (I'm not the sharpest tool in the box...). Thanx for the info though, it was definitely worth a shot. Jeff What version of AutoIt are you using? if not using v3.2.01 that is probably your problem. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Zedna Posted September 8, 2006 Share Posted September 8, 2006 Well, I made the following substitution: Local $p = DllStructCreate("char[4096]") Local $p = ^ERROR Error: Unknown function name. DllStructCreate() is implemented from 3.1.1.beta versions , so you are using old 3.1.1 release. Now when new release 3.2 is out instal this latest version and all will be OK. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
PaulIA Posted September 13, 2006 Share Posted September 13, 2006 I've been working with the TreeView extension posted here and it works great! I've got a project where I need to configure some XP machines during an unattended install and this is the ticket! I've got a couple of questions that maybe you can answer for me: I'm executing code to bring up the machines "Performance Options" dialogs (you get there by right clcking on "My Computer", select "Properties", select "Advanced" and then select the "Settings" button under the "Performance" group). I can now read the TreeView item names just fine. The problem is, I need to be able to tell which ones are currently checked. In addition, I need to be able to check or uncheck items. I can't seem to find how to do this with the code/dll posted here. What am I missing? I'm sure this is a real newbie question, but I'd appreciate any help you can give. Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
Zedna Posted September 13, 2006 Share Posted September 13, 2006 I can now read the TreeView item names just fine. The problem is, I need to be able to tell which ones are currently checked. In addition, I need to be able to check or uncheck items. I can't seem to find how to do this with the code/dll posted here. What am I missing?I'm sure this is a real newbie question, but I'd appreciate any help you can give.For check/uncheck you can use:SelectTreeViewItem($hwnd, $hitem)ControlSend() - with '{Space}'But for get checked status isn't any way with this Dll.It must be implemented TVM_GETITEM & TVIF_STATEsimilarly as it's done for TVM_GETITEM & TVIF_TEXT.Look at my example of this for your GUI (not usable for external GUI)UDF _TreeViewGetItemState, for treeviews with checkboxes and so on... Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
JeffHarris Posted September 14, 2006 Share Posted September 14, 2006 DllStructCreate() is implemented from 3.1.1.beta versions , so you are using old 3.1.1 release.Now when new release 3.2 is out instal this latest version and all will be OK.Sorry to be such a wet blanket, but I downloaded and installed the latest version, and I am still getting the exact same results. Jeff Link to comment Share on other sites More sharing options...
yoruichiy Posted May 7, 2008 Share Posted May 7, 2008 hello, I tried the dll but it doesn't work, I have a windows error, I reused the code given for systreeview what can I do to count items on a systreeview32 Link to comment Share on other sites More sharing options...
Zedna Posted May 7, 2008 Share Posted May 7, 2008 hello,I tried the dll but it doesn't work, I have a windows error, I reused the code given for systreeview what can I do to count items on a systreeview32As you can see this is VERY OLD thread.In AutoIt there are implemented all TreeView functions now. Look at ControlTreeView() and all _GUICtrlTreeView_xxx() UDF functions. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
yoruichiy Posted May 7, 2008 Share Posted May 7, 2008 As you can see this is VERY OLD thread.In AutoIt there are implemented all TreeView functions now. Look at ControlTreeView() and all _GUICtrlTreeView_xxx() UDF functions.yes but all functions are working on treeviews and not on systreeviewsI tried expand, itemscount ....but it always returned 0 even if there were 10 nodes Link to comment Share on other sites More sharing options...
GaryFrost Posted May 7, 2008 Share Posted May 7, 2008 yes but all functions are working on treeviews and not on systreeviewsI tried expand, itemscount ....but it always returned 0 even if there were 10 nodesMight want to rethink that statement.Run the example from the help for GUICtrlCreateTreeView, and run the AutoIt Window Info tool and see what the "treeview" classname for the control is SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
joewisnewski Posted August 19, 2009 Share Posted August 19, 2009 tweast many thanks!! I'm using your DLL in my work projects and it's really good. Thanks also for posting sources here >_< I found only one little mistake: Func GetSelectedTreeViewItem($hwnd, $hitem)oÝ÷ ÚÈhºW[y«¢+ÙÕ¹ÑM±ÑQÉY¥Ý%Ñ´ ÀÌØí¡Ý¹¤ Workaround is to pass always 0 in unnecessary parameter $hitem (or change AU3 wrapper for it). Dll can be renamed to what you want, I renamed it to TreeViewExtension.dll (from AutoItTreeViewExtension.dll), because that Dll can be used like universal Dll not only from AutoIt but also from another program languages. And I created AU3 wrapper TreeViewExtension.au3: my slightly corrected wrapper for this Dll derived from your original TreeView_Testing.au3: TreeViewExtension.au3 see my post in support forum about it Hi! I am trying to use the AutoItTreeViewExtension.dll and am getting a Crash in AutoIt (v3.3.0) whenever I try and call TreeViewGetRoot (Even in the example application -- any help would be appreciated, I am at a loss!) Joe 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