Jump to content

Using _GUICtrlTab_ActivateTab


Go to solution Solved by Danyfirex,

Recommended Posts

 

Good morning, can someone teach me how to use _GUICtrlTab_ActivateTab or explain to me why it doesn't work?

I looked for help on the internet, but they are very specific to IE or other browsers.

I'm wanting to open the TaskManager in Tab 02 (Performance / "Desempenho" ), but it doesn't work, and it doesn't return an error.

 

 

image.png.13da0ef27b1f712af977d1a9dab5a3e1.png

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>

#RequireAdmin
$hWnd =  Run("taskmgr.exe")

$hWnd  =  WinWaitActive ("[CLASS:TaskManagerWindow]", "")

WinActivate ( $hWnd )

_GUICtrlTab_ActivateTab ( $hWnd, 2)

 

Link to comment
Share on other sites

You need to use the Tab handle in ActivateTab.

 

;~ #AutoIt3Wrapper_UseX64=y
#RequireAdmin
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>

Local $iPID = Run("taskmgr.exe")
Local $hWnd = WinWaitActive("[CLASS:TaskManagerWindow]", "")
WinActivate($hWnd)
Local $hTab = ControlGetHandle($hWnd, "", "SysTabControl321")
_GUICtrlTab_ActivateTab($hTab, 1)

 


Saludos

Link to comment
Share on other sites

@ARPFre

You could also set the default startup tab for taskmanager in its' Options menu,
or manipulate the registry where it saves it's options:

in HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\TaskManager

Modify the REG_DWORD named StartUpTab
Values range from 0 to 6 for tabs from left to right.
(checked this on Win 10 21H2)

Link to comment
Share on other sites

8 minutes ago, Danyfirex said:

You need to use the Tab handle in ActivateTab.

 

;~ #AutoIt3Wrapper_UseX64=y
#RequireAdmin
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>

Local $iPID = Run("taskmgr.exe")
Local $hWnd = WinWaitActive("[CLASS:TaskManagerWindow]", "")
WinActivate($hWnd)
Local $hTab = ControlGetHandle($hWnd, "", "SysTabControl321")
_GUICtrlTab_ActivateTab($hTab, 1)

 


Saludos

Thank you very much,

It worked 90%, now I think it's a Windows error.

When you switch to the performance tab, the application does not accept it, that is, it marks only the tab and the part below remains unchanged.

I think it's ugly, but I'll adapt with Send Right and Left.

Link to comment
Share on other sites

  • Solution
Link to comment
Share on other sites

9 minutes ago, Danyfirex said:

Change _GUICtrlTab_ActivateTab for _GUICtrlTab_ClickTab.

 

Saludos

Yes, it worked correctly.

Thanks, I didn't know about this resource, I'm learning a lot from these forums, it's almost my only source.

From what I was reading the "ControlGetHandle" can be used for any handle, so I can click and manipulate the applications?

  And where did "SysTabControl321" come from?

ons?

Edited by ARPFre
Link to comment
Share on other sites

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