Clicking on the Device Manager "View" item on W7x64

05/28/2017 00:40 Bob4K#1
Hi,

I want to automatize starting the device manager in a mode that shows hidden devices.

It needs to be started from a DOS windows with the "set devmgr_show_nonpresent_devices=1" command issued first, then to you need to click on View -> Show Hidden Devices

I have a problem with the click.

The autoit info tool shows that the menu bar has no name:


Code:
>>> Window <<<<
Title:    Device Manager
Class:    MMCMainFrame
Position:    -4, -4
Size:    2568, 1576
Style:    0x15CF0000
ExStyle:    0x00000100
Handle:    0x00000000000D1E34
 
>>>> Control <<<<
Class:    ToolbarWindow32
Instance:    2
ClassnameNN:    ToolbarWindow322
Name:   
Advanced (Class):    [CLASS:ToolbarWindow32; INSTANCE:2]
ID:    4097
Text:   
Position:    2, 2
Size:    2556, 26
ControlClick Coords:    116, 14
Style:    0x56009845
ExStyle:    0x00000084
Handle:    0x0000000000211C66
 
>>>> Mouse <<<<
Position:    118, 41
Cursor ID:    2
Color:    0x000000
 
>>>> StatusBar <<<<
1:   
2:   
3:   
 
>>>> ToolsBar <<<<
1:    21508    Show
2:    21513    &File
3:    21509    &Action
4:    21510    &View
5:    21511    Fav&orites
6:    21512    SnapinMenu
7:    21514    &Help
 
>>>> Visible Text <<<<
Device Manager on local computer
 
 
>>>> Hidden Text <<<<
ActionsPaneView
0

I tried to use the CLASS instead with:


Code:
#include <MsgBoxConstants.au3>
#include <Array.au3>
#include <File.au3>
#include <String.au3>
#include <FileConstants.au3>
#include <WinAPIFiles.au3>
#include <AutoItConstants.au3>
 
 
$sTitle = "Administrator: C:\Windows\System32\cmd.exe"
Run("C:\Windows\System32\cmd.exe")
$hdn  = WinWaitActive ($sTitle, "" , 1 )
Send("set devmgr_show_nonpresent_devices=1" & @CRLF)
 
Send("start devmgmt.msc" & @CRLF)
$sTitle = "Device Manager"
$hdn2  = WinWaitActive ($sTitle, "" , 4 )
WinActivate($hdn)
Send("exit" & @CRLF)
WinActivate($hdn2)
ControlClick ($sTitle, "", "[CLASS:ToolbarWindow32]", "left", 1, 117, 13)
Send("{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}")
but that does not work. Using the 4097 id does not work either.

Any suggestions?

Thanks.