Jump to content

_GUICtrlTreeView_FindItem doesnt find item (Newbie)


MrWhite
 Share

Recommended Posts

Hi all,

I'm having problems automating the device manager. The problem to solve is, that my PC forgets all about it's HDMI audio output, when I switch to a different audio device. In this case the device has to be re-enabled.

So here is what I've got at the moment (mostly copied from other forum postings):

#RequireAdmin
#include-once
#Include <GuiTreeView.au3>

; Open Device Manager
Run(@ComSpec & " /c " & 'devmgmt.msc', "", @SW_HIDE)
WinWaitActive("Geräte-Manager")

$hTree = ControlGetHandle("Geräte-Manager", "", "[Class:SysTreeView32;Instance:1]")
$hItem = _GUICtrlTreeView_FindItem($hTree, "A", True)

MsgBox(1, "x", "tree=" & $hTree & " item=" & $hItem)

My problem is, that the finditem function does not find an item (i.e. $hItem is 0), although there is most definately an item containing "A". (I'm really looking for NVIDIA whatnot in the third level down from the root under audio devices, but I tried to ensure that the function is returning anything at all, which does not seem to be the case.)

I'm on Vista x64 using AutoIt v3.2.12.1 (according to the help file).

Thanks for any hints.

Best regards

Mr White

Link to comment
Share on other sites

Hi Zedna!

Thanks for the hints.

Check value of $hTree

$hTree = ControlGetHandle("Geräte-Manager", "", "[Class:SysTreeView32;Instance:1]")

If @error then ...

$hTree contains a handle to the tree.

Also try text "NVIDIA" instead of "A"

I had tried NVIDIA first, but that didn't return anything. There are definately items containing the upercase letter A, so the function should return a handle to some item.

Anyway I got a bit further by trying out some other variants, but have run into more problems.

I'll do another post with my current code.

Best Regards

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...