Jump to content
Sign in to follow this  
ankitsablok89

How to retrieve the handle of a tab inside a window using Python and AutoItX?

Recommended Posts

ankitsablok89

The problem I am trying to solve is the following, I have a window with a tab panel inside that window just like the one below and I want to access one of the tabs inside that window, I am able to do that in autoit but not when I port my autoit code to Python using PyWin32, the situation is explained a bit more further on.

Windows_ControlPanel_WebService_Setup_Ru

  

I am trying to port my autoit code to Python using PyWin32 and AutoItX, I am successfully able to retrieve the handle of a "tab" embedded inside a window using autoit solely and here is the code for it - 

; as the "Plugin" control is a tab in the process manager this statement gets the internal hexadecimal handle of the tab control in the "Process Manager" window
   $hTab = ControlGetHandle($hWnd, "", "SysTabControl321")

but when I execute the same code inside my Python script it doesn't retrieve the address of the tab successfully, the code is as follows -

import time
import LogIt
import datetime
import win32con
import win32gui
import win32api
import win32com.client


# this makes use of the AutoITX.dll that we registered with the Windows OS
autoit = win32com.client.Dispatch("AutoItX3.Control")


# as the "Plugin" control is a tab in the process manager this statement gets the internal hexadecimal handle of the tab control in the "Process Manager" window
hTab = autoit.ControlGetHandle(hWnd, "", "[CLASS:SysTabControl32; INSTANCE:1]")

the above code always shows me the following address for the tab control I am interested in - 

In function enableExplorerPlugin($brestartExplorer): hTab - 0x0000000000000000

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  

×