Jump to content

Device manager not able to select root


Recommended Posts

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
Link to comment
Share on other sites

the way to automate such system-related tasks is rarely best handled by the GUI. have you tried DevCon?

http://msdn.microsoft.com/en-us/library/windows/hardware/ff544707(v=vs.85).aspx

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...