Sign in to follow this  
Followers 0
vikrams

Device manager not able to select root

4 posts in this topic

#1 ·  Posted (edited)

Hi All , 

I want to automate driver installation using device manager . I am able to get device manager windows pop up but i am not able to  select root tree item .

Please let me know  i am missing something given below code 

#Include <GuiTreeView.au3>

ShellExecute('devmgmt.msc')
WinWaitActive("Device Manager")
Global $hTree = ControlGetHandle("Device Manager", "", "[Class:SysTreeView32;Instance:1]")
MsgBox(0, "ControlGetHandle Example", "The control handle of Edit1 is: " & $hTree)
$hItem = _GUICtrlTreeView_FindItem($hTree, "Human Interface Device", True)
_GUICtrlTreeView_SelectItem($hTree, $hItem, $TVGN_CARET)
$next = _GUICtrlTreeView_GetNext($hTree, $hItem)
; Focus treeview and Send Enter
ControlFocus("Device Manager", "", $hTree)
ControlSend("Device Manager", "", $hItem, "{ENTER}")

Exit

Thanks and Regards,

Vikram

Edited by vikrams

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

thanks Orbs about Devcon, actually i want to automatation on autoit. Please if you have any idea about what is wrong in the above code

Edited by vikrams

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Seems to work for me.  HID root is selected and next returns the handle for the next treeview item.

What are you trying to do with the tree view?  What do you expect to happen when you send "{Enter}"?

Also, I agree with Orbs suggestion.

Edited by spudw2k

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0